How to change URL names in Umbraco
Asked Answered
B

5

9

This is my first time round using Umbraco and I have created Document Types / Pages using the wrong naming format and now this has transpired into my page URL's, for instance /about-page/. How would I go about changing them to /about as I have searched the back-end admin panel and there dose't seem to be an option to change their link to document values.

Would anyone be able to provide a simple code based example using umbracoUrlAlias or umbracoUrlName how I could change this preferably in Razor.

Thanks

Bennie answered 30/7, 2014 at 9:41 Comment(0)
A
23

Editing @run yards Solution by digbyswift help in comment

Correct Solution:

  1. Create Property on in Document Types which applies to all pages you want to change the URL
  2. Call the name anything you want e.g Page URL and Possibly give it a new tab.
  3. Call the alias umbracoUrlName
  4. Type as text sting
  5. Should not be Mandatory (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
  6. Tab as Generic
  7. Click Save on top right on the page

Added screenshot for starter kit on Umbraco v7.2.5 Adding screenshot for starter kit on Umbraco v7.2.5

Argilliferous answered 17/5, 2015 at 14:29 Comment(2)
I'm using Umbraco 7.4.3 and I can't see any tab called Generic properties. Is there any way to get this tab?Mikesell
@Mikesell It looks like before 7.4 this would add the property to the "Properties" tab (the one that has the "ID", "Created by", and "Last edited" properties among others. Now you have to just add this property to a different tab. See this Umbraco forum post.Tully
A
4

Unless I'm very much misunderstanding your issue, you should just be able to change the name of your page and republish. This doesn't need an additional field, just change the value in the "Properties" tab and republish the page. This will automatically change the URL of the page.

Aubreyaubrie answered 31/7, 2014 at 9:5 Comment(2)
you can also create a text field with alias umbracoUrlName if you need the part of the url to be something other than the 'urlified' node name. (also if you want to redirect traffic from the old url to the new one I recommend the urlTracker package our.umbraco.org/projects/developer-tools/301-url-tracker)Saul
Of course, but sometimes the simplest approach is the best. You should add your comment as an answer though as the OP did ask for an example of how to use it.Aubreyaubrie
F
2

You can also create a property called umbracoUrlName using a TextString property editor. If this has a value then it will generate the URL fragment for the page using this value, rather than the page name. This changes the URL for the page, rather than creating an alias, like umbracoUrlAlias.

Fellows answered 11/8, 2016 at 7:58 Comment(0)
B
0

Solution:

  • Create property on in Document Types which applies to all pages you want to change the URL
  • Call the name anything you want e.g Page URL and Possibly give it a new tab.
  • Call the alias umbracoUrlAlias
  • Type as text sting
  • Make it required (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
  • Go into all your pages and rename them using the property you just created
  • Now with your code, say with the navigation where you have used .Url change it to .umbracoUrlAlias and the new URL's will be used.

Note if you don't use .umbracoUrlAlias the links will still be active i.e. they work but they won't be displayed in the address bar as .Url spits out the original ones associated with the page.

Bennie answered 30/7, 2014 at 10:5 Comment(1)
This is overkill when you can just change the name of your document and republish it. If you need to override the URL you need to use umbracoUrlName and it should not be mandatory as this forces the user to essentially repeat the bad practice you have mistakenly started. Either way, if you need a separate page title, you should add a separate pageTitle field and use an event to pre-populate this on Newing.Aubreyaubrie
E
0

You can apply on URL names in web.config:

In section find:

<add key="umbracoUseDirectoryUrls" value="false" /> 

this will set url names for new created items to name.aspx

If you set this to 'true' then new items will be named like /name/

Additionaly you might want to avoid of Handling some urls by Umbraco pipline, just use this setting - add URLs which must be bypassed:

<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />
Extrapolate answered 7/8, 2014 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.