Hi, I have an Umbraco V4 website and I would like to make the URL's search engine optimised. The site is a vacancy website and will have pages as follows:
Jobs - Job 1 - Job 2 - Job 3
These pages have got a property that is called Location and what I would like to be able to do is have the URL something like this:
How can I achieve this without the user having to call the node "job 1 in london" or without having to use umbracoUrlName? Basically I want the SEO url to be created automatically without the end user having to do anything (I would probably want to add the node ID to the URL or some other unique number so that I don't get any duplicate URLs). Is this possible using XSLT or is it possible at all for that matter?
I don't see why you don't want to use the umbracoUrlName property that's being populated based on the document properties. How else would you handle this? Create your own property and set the url name to whatever needs to be there (using event handlers that'll spit out that url)?
I'd still use the umbracoUrlName property and populate that with your own generated seo url
When you say populate it with document properties what do you mean? Do you mean it is possible to have it populated automatically with for example the nodeName, the value of the Location property and the node ID? If it is then this is perfect and exactly what I want to do. I just don't want the Umbraco user to have to enter something in there manually because they are likely to forget or likely to enter duplicate information (which I assume will cause a problem?).
By populating I mean: subscribe to the document save/publish event and set the property of the umbracoUrlName to your custom generated url based on the documents properties.
An introduction to event handling in umbraco can be found in the wiki section.
Yes some examples would be nice if you don't mind, is it also possible using this to change the nodeName when saved so that it has a unique number on the end (possibly the node ID).
not sure if changing the node name is a great idea, and especially if you're going to use umbracoUrlName property on the content document as this property changes the url when it's saved to cache and therefore when is requested using NiceUrl()
you can change the nodeName by using the .Text property on the document.
Just been reading up and I think I'm starting to understand how to use the Event Handlers. Can you give me an example of how I would change the url to be: nodename-in-location-nodeID.aspx
Do I need to add the umbracoUrlName as a property for the document? Also how do I restrict it so that it only changes the URL's for a certain document type. I dont want normal pages having their url changed especially as they will not even have the location property!
URL rewriting for SEO purposes
Hi, I have an Umbraco V4 website and I would like to make the URL's search engine optimised. The site is a vacancy website and will have pages as follows:
Jobs
- Job 1
- Job 2
- Job 3
These pages have got a property that is called Location and what I would like to be able to do is have the URL something like this:
www.mywebsite.com/job-1-in-London.aspx
How can I achieve this without the user having to call the node "job 1 in london" or without having to use umbracoUrlName? Basically I want the SEO url to be created automatically without the end user having to do anything (I would probably want to add the node ID to the URL or some other unique number so that I don't get any duplicate URLs). Is this possible using XSLT or is it possible at all for that matter?
I don't see why you don't want to use the umbracoUrlName property that's being populated based on the document properties. How else would you handle this? Create your own property and set the url name to whatever needs to be there (using event handlers that'll spit out that url)?
I'd still use the umbracoUrlName property and populate that with your own generated seo url
Cheers,
/Dirk
Hi Dirk,
When you say populate it with document properties what do you mean? Do you mean it is possible to have it populated automatically with for example the nodeName, the value of the Location property and the node ID? If it is then this is perfect and exactly what I want to do. I just don't want the Umbraco user to have to enter something in there manually because they are likely to forget or likely to enter duplicate information (which I assume will cause a problem?).
By populating I mean: subscribe to the document save/publish event and set the property of the umbracoUrlName to your custom generated url based on the documents properties.
An introduction to event handling in umbraco can be found in the wiki section.
And now that I've got your attention, be aware about the difference between umbracoUrlName and umbracoUrlAlias
Let us know if you need some examples.
Cheers,
/Dirk
Hi Dirk,
Yes some examples would be nice if you don't mind, is it also possible using this to change the nodeName when saved so that it has a unique number on the end (possibly the node ID).
not sure if changing the node name is a great idea, and especially if you're going to use umbracoUrlName property on the content document as this property changes the url when it's saved to cache and therefore when is requested using NiceUrl()
you can change the nodeName by using the .Text property on the document.
(just an example and untested!)
Cheers,
/Dirk
Thanks Dirk,
Just been reading up and I think I'm starting to understand how to use the Event Handlers. Can you give me an example of how I would change the url to be: nodename-in-location-nodeID.aspx
Do I need to add the umbracoUrlName as a property for the document? Also how do I restrict it so that it only changes the URL's for a certain document type. I dont want normal pages having their url changed especially as they will not even have the location property!
Hi, you can check the document type alias with the following code so that you only execute your changes on certain document types:
And yes, you need to add the umbracoUrlName as a property and then you can modify it like this with the node ID on the end to keep it unique:
is working on a reply...