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.
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.
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>
}
I am looking to do the same. Thank you Ruben for sharing your solution, that's very helpful !
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?
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.
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
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)
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.
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
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.
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.
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.
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.
I don't think this is possible. Vorto will list all configured languages by default.
Dave
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.
Nice..looking forward to it. We actually need something similar as well.
Dave
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:
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
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 :).
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
I never heard of the iUrlSegmentProvider, that's why i didn't use it :)
But it's intresting for future use
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
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
Hi Ruben & Dave,
I am looking to do the same. Thank you Ruben for sharing your solution, that's very helpful !
I would like to create a multi language addresses directory and I don't want to have a custom url in each languages.
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.
I've also done a uHangout about 1-1 multilingual in Umbraco where a single node can have different URLs per language: https://www.youtube.com/watch?v=DWjbJiIUQdk
A Vorto value is used to change the URL with a UrlProvider and ContentFinder:
https://github.com/jbreuer/1-1-multilingual-example/blob/master/Sources/Umbraco.Extensions/ContentFinders/MultilingualContentFinder.cs
https://github.com/jbreuer/1-1-multilingual-example/tree/master/Sources/Umbraco.Extensions/UrlProviders
Project page:
https://our.umbraco.org/projects/developer-tools/1-1-multilingual-example/
Jeroen
Hello Jeroen,
Can you please mention in detail, how to implement it in the project only the Url Segment part.
Hello,
I explain everything in this video: https://www.youtube.com/watch?v=DWjbJiIUQdk
Jeroen
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.
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
Hello Jeroen,
Yes, I will follow each and every step and let you know my detailed approach whatever happens.
Regards.
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,
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,
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
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.
is working on a reply...