Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rubinho 30 posts 218 karma points
    Sep 15, 2015 @ 18:59
    Rubinho
    0

    Creating Page URL's with Vorto

    Hi,

    I'm thinking about how to create my URL's for a multilang website that runs on a single domain.

    My goal is to achieve the following structure with one single page using Vorto:

    • mysite.com/en/about-us

      mysite.com/nl/over-ons

      mysite.com/fr/a-propos-de-nous

    I think the best way is to create a ContentFinder which will split up the url and searches for the right node to show.

    To achieve this, i have to create a Vorto Textstring field (i'll call it "NodeName") which will have my classic nodename translations.

    Because i already have my real node, i want to create this Vorto field with only 2 languages instead of 3 (my nodename is already the url name for the default language).

    So, question is: Is it possible to create a Vorto field with only 2 of the 3 languages? All other Vorto fields have 3 languages.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Sep 16, 2015 @ 06:41
    Dave Woestenborghs
    0

    I don't think this is possible. Vorto will list all configured languages by default.

    Dave

  • Rubinho 30 posts 218 karma points
    Sep 16, 2015 @ 07:25
    Rubinho
    1

    Thanks,

    In the meantime, i already created a protoype for the url rewriting with:

    • A ContentFinder

    • Extensionmethod on iPublishedContent to get the translated URL

    Everything seems to work. I'll test it and shared it in a couple days for everyone.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Sep 16, 2015 @ 07:56
    Dave Woestenborghs
    0

    Nice..looking forward to it. We actually need something similar as well.

    Dave

  • Rubinho 30 posts 218 karma points
    Sep 21, 2015 @ 18:58
    Rubinho
    102

    Here's my solution to create translated url's:

    Start with a property on your page, called "pagename" which is a Vorto TextString. This field will be the alternative for the nodename, which can't be translated. If the translated field is empty, my code will use the nodename as fallback.

    The url's will look like this: mysite.com/en/my-page/subpage. You'll see the language part contains 2 characters and is in my case just the first 2 characters from the culturename. Feel free to change this if your case needs something else.

    You can download my code on http://progressive.be/vortoUrl.zip

    The code consist of the following files;

    VortoContentFinder: This is the contentfinder which will look up the URL and will split it into parts and tries to find the corresponding node.

    Events.cs: This file registers the VortoContentFinder. It's necessary to use this.

    ExtensionsForString: Contains an extensionmethod to clean the vorto Pagename values, to have it url friendly

    ExtensionsForIPublishedContent: This contains 2 important extensionmethods: VortoUrl(): This will give you the translated url you can use in your pages and menu's. Use it instead of the default Url property on iPublishedContent. The other extensionmethod is PageName(): When you create a menu, use PageName instead of the Name property. This will give you the translated pagename or default nodename as fallback

    Usage in your view: As example; i'll give you my menu code:

                @foreach (var menu in menuItems)
                {
                    <li><a href="@menu.VortoUrl()"><span>@menu.PageName()</span></a></li>
                }
    

    PS: I created a blogpost about this on http://progressive.be/blog-cases/umbraco-vorto-create-friendly-urls Maybe i will extend it a bit in the future

  • Mohammed BOUTEBEL 64 posts 103 karma points
    Jan 14, 2016 @ 08:42
    Mohammed BOUTEBEL
    1

    Hi Rubinho. Your solution looks like pretty elegant. But it doesn't compile, because of a probably missing file.

    I guess you wrote a library called Constants with the namespace ChickenMasters.Business.Constants , and it is missing in your zip archive.

    Can you share this file, please ? I'm excited to use this feature for a multilangages site using Vorto :).

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Sep 22, 2015 @ 06:49
    Dave Woestenborghs
    0

    Have you considered implementing a IUrlSegmentProvider for the URL that reads your text box.

    This way you eliminate the need of the contentfinder. And you can also see the URL in the backend https://our.umbraco.org/Documentation/Reference/Routing/Request-Pipeline/outbound-pipeline#segments

    Dave

  • Rubinho 30 posts 218 karma points
    Sep 22, 2015 @ 08:22
    Rubinho
    0

    I never heard of the iUrlSegmentProvider, that's why i didn't use it :)

    But it's intresting for future use

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Sep 22, 2015 @ 08:24
    Dave Woestenborghs
    0

    Normally Umbraco generates the url segment based on the name of the item. With a Url segment provider you can overrule what name will be generated.

    Dave

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Sep 23, 2015 @ 06:17
    Dave Woestenborghs
    0

    Hi Ruben,

    It seems to IUrlSegmentProvider can't handle this.

    Please have a look at this issue and vote it up : http://issues.umbraco.org/issue/U4-7130

  • MrFlo 159 posts 403 karma points
    Sep 29, 2015 @ 08:54
    MrFlo
    0

    Hi Ruben & Dave,

    I am looking to do the same. Thank you Ruben for sharing your solution, that's very helpful !

    1. I am wondering, is there a way to call the Umbraco methods to generate the friendly url? So you keep the same engine to generate them and find them back?
    2. Is there a way to apply Vorto on the "umbracoUrlName" or "umbracoUrlAlias" property alias ?

    I would like to create a multi language addresses directory and I don't want to have a custom url in each languages.

  • MrFlo 159 posts 403 karma points
    Nov 24, 2015 @ 14:59
    MrFlo
    0

    Hi,

    For those who are looking for one solution. You could use the ToUrlSegment() method to generate the url:

    ((IPublishedContent)yourpage).GetVortoValue<string>("title").ToUrlSegment()

    Then I am using url rewriting (in web.config not the old slower url config file) and then you can find back the right node using examine or just searching the right node in the children.

    To have unique url you can call the onSave event.

    Or you can use the virtual Content system. Jeavon did a nice example with it. But my main problem was that you are loosing the inheritance of the parent (no selected item in menu,etc) https://github.com/Jeavon/FunWithVirtualContent

    Hope that this could help someone.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 29, 2016 @ 08:00
  • Mangirish Wagle 34 posts 106 karma points
    Aug 08, 2016 @ 12:15
    Mangirish Wagle
    0

    Hello Jeroen,

    Can you please mention in detail, how to implement it in the project only the Url Segment part.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 08, 2016 @ 13:05
    Jeroen Breuer
    1

    Hello,

    I explain everything in this video: https://www.youtube.com/watch?v=DWjbJiIUQdk

    Jeroen

  • Mangirish Wagle 34 posts 106 karma points
    Aug 23, 2016 @ 13:24
    Mangirish Wagle
    0

    Hello Jeroen,

    I will refer the video keenly and get back to you regarding its success. When I download your project, things go on quite well and smooth, but when I create a new project and go as per your naming conventions, things doesn't go as expected It returns this error after page publish.

    Oops: this document is published but is not in the cache (internal error - see log)

    If there's any fix for this please suggest.

    Regards.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 23, 2016 @ 14:06
    Jeroen Breuer
    0

    That could be related to a lot of things. Probably because something is wrong with the UrlProvider. Let me know if you could follow all the steps from the video. Then it should work.

    Jeroen

  • Mangirish Wagle 34 posts 106 karma points
    Aug 24, 2016 @ 06:41
    Mangirish Wagle
    0

    Hello Jeroen,

    Yes, I will follow each and every step and let you know my detailed approach whatever happens.

    Regards.

  • Mangirish Wagle 34 posts 106 karma points
    Aug 25, 2016 @ 07:43
    Mangirish Wagle
    0

    Hello Jeroen,

    I tried a lot many times...nearly 5-6 times installing Umbraco and implementing your functionality in it...still I finally get the same error

    Oops: this document is published but is not in the cache (internal error - see log)

    I maybe wrong in some steps... Let me tell you my detailed approach.

    1) Installed Umbraco 7.4.3 with Txt starter Kit.

    2) Since ModelsBuilder is by default installed, I didn't install it.

    3) Installed Vorto and Nested Contents.

    4) Created Document Types like Detached and NewsDetached

    5) Added UrlPreview onto App_Plugins

    5) Created Extra Data Types "Vorto Url", "Vorto NewsDetached", "Url Preview"

    6) Created Url related property types "urlPreview" and "urlSegment"

    7) Tried urlSegment by adding some content onto it.

    After all this I got this error.

    I referred your video though. I got that you disabled the default Url Provider and added custom one.. This may have caused the issue. Still trying to grasp some things like NuCache which didn't get onto my mind still.

    The things which you have done to this all stuff are really commendable but a lot of extra customisations are done on top of it....so much that it could work as a starter kit for umbraco!

    But, My needs are basic ones.. just adding the urlSegment property and making permalinks translatable. No need of Url Preview also... according to me.

    I did tried using umbracoUrlName property using vorto before using yours but it gave stray permalinks.

    1) Created custom data type "Vorto Url" using textstring property editor.

    2) Created umbracoUrlName property in Master Document Type

    3) Went in content on Go Further node and edited the permalinks

    4) French - furthu Dutch -- fooru English -- further

    5) It gave these stray permalinks...

    /nl/values-en-usfurther-nl-nlfooru-fr-frfurthu-dtdguid823ea30b-901b-4280-820c-360d03dde182/

    http://localhost:32323/fr/values-en-usfurther-nl-nlfooru-fr-frfurthu-dtdguid823ea30b-901b-4280-820c-360d03dde182/

    http://localhost:32323/en/values-en-usfurther-nl-nlfooru-fr-frfurthu-dtdguid823ea30b-901b-4280-820c-360d03dde182/

    How I would implement this.. Please help me in this issue.

    Regards,

  • Mangirish Wagle 34 posts 106 karma points
    Aug 25, 2016 @ 07:51
    Mangirish Wagle
    0

    Hello Jeroen,

    Just one thing to add..

    Due to time constraint, I only referred your video once but keenly as far as possible. Some things were not grasped by me easily like NuCache, extra customisations made by you...etc.

    These may take time from my side to grasp these things.

    Hence, requesting you to explain the multilingual permalinks implementation using vorto in the simplest way as possible.

    Regards,

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 25, 2016 @ 08:01
    Jeroen Breuer
    1

    Hello,

    Sorry I'm really busy right now so I don't have time to help. Maybe it's better to start with the example project and use that as a basis instead of starting a new project.

    The NuCache part is an experiment and shouldn't be used at the moment. It's a different branch so please use the default branch.

    Jeroen

  • Mangirish Wagle 34 posts 106 karma points
    Aug 25, 2016 @ 08:47
    Mangirish Wagle
    0

    Hello Jeroen,

    I think this is the best way, to use your example project as a startpoint. I was trying this.. because I already developed multilingual attributes using Vorto but without using txt. Anyways, I will experiment on your basis project and get to you on issues faced if any. Things I will try.

    1) Changing the document type aliases umbMaster to master and making changes in code likewise.

    2) Upgrading Umbraco from 7.4.3 to latest and testing your functionality under these load conditions.

    etc. and so on...

    Anyways.. thank you very much for your help. I am following you already on Twitter to know your developments in Web Technology.

    Will remain connected.

    Regards.

Please Sign in or register to post replies

Write your reply to:

Draft