There is an attribute in the xml for a node that gives you the url name for it: @urlName. So for you "Man Utd" node you would get "man-utd" and nothing else.
One question though, I just changed my IIS7 configuration according to this and setting to true the umbracoUseDirectoryUrls key. The site has been up for over a year now and it has some well positioned keywords in the search engines, will this cause a negative effect on my rankings?
and now find I've lost all the links to the stylesheets! How do you get around that? It was most unexpected. I'm developing on W7 with WebMatrix, so not a full IIS.
This would probably have happened regardless that you made the switch to extensionless urls since you need to use absolute urls, to reference css, javascript etc. instead of relative urls.
It has nothing to do with site using extensionless urls :-)
Interesting, it's been fine for the last 4 days and only changed as soon as I changed the web.config file. Maybe I was lucky. This is my first Umbraco site;)
NiceURL without .aspx?
Hi,
I need to grab the nice URL of a 'directory' of my site without the .aspx extension.
So nodes are
- Football Team
- Charlton Athletic
- Man Utd
I need to grab them separately for reasons I won't go into.
So above I'd like umbraco.library:NiceUrl($sportID) to return "Football-Team/Man-Utd.aspx"
Thanks
Rich
Hey Rich a simple way to do remove the aspx for some of your links is as follows.
By wrapping the niceURL call with a replace that finds the .aspx and replaces it with nothing.
However looking at your logic you shouldn't need to build up the url or string like that, you should be able to use xPath to return that.
You could just do this and it should already retrieve the full path of the url (which includes Football Team)
I would be happy to help you with your XSLT or xPath if you explain exactly what you are trying to achieve.
Warren :)
Why not just switch to extension-less urls in umbraco and never see the '.aspx' again? Anywhere?
In the web.config file, just set:
And then publish all the top-most nodes (and their children) to have umbraco re-calculate the urls.
cheers,
doug.
There is an attribute in the xml for a node that gives you the url name for it: @urlName. So for you "Man Utd" node you would get "man-utd" and nothing else.
Thanks, all great solutions!
Shouldn't the path end with a trailing slash? "/"
One question though, I just changed my IIS7 configuration according to this and setting to true the umbracoUseDirectoryUrls key. The site has been up for over a year now and it has some well positioned keywords in the search engines, will this cause a negative effect on my rankings?
I just updated the web.config entry to:-
and now find I've lost all the links to the stylesheets! How do you get around that? It was most unexpected. I'm developing on W7 with WebMatrix, so not a full IIS.
Craig
Sorted it myself. I just needed a forward slash infront of the css. i.e. <link rel="stylesheet" href="/css/jquery-ui-1.8.16.custom.css">
Hope this helps someone
Craig
Hi Craig
This would probably have happened regardless that you made the switch to extensionless urls since you need to use absolute urls, to reference css, javascript etc. instead of relative urls.
It has nothing to do with site using extensionless urls :-)
/Jan
Interesting, it's been fine for the last 4 days and only changed as soon as I changed the web.config file. Maybe I was lucky. This is my first Umbraco site;)
Craig
Thanks Douglas! This did the trick for me.
Incidently it had to be at the end of the appsettings for some reason, but it worked as you said.
I'd like to upvote your response but don't have the karma yet. Thanks
is working on a reply...