Grouping umbraco pages in folders without affecting URL
Asked Answered
Z

1

5

One of our Umbraco sites is getting a bit messy and I was wondering if there was a way of grouping pages in folders without affecting the URL. So for example if under the homepage I have some top level sections, some footer links and various other system pages. I'd like to group the footer pages in a footer folder, the system pages in a system folder but I don't want all the URLs to become /footer/page1, system/contact etc.

Is there a nice way of doing this, maybe something with umbracoUrlName?

Zibeline answered 9/5, 2013 at 15:41 Comment(0)
B
11

There are two answers, first you could turn on the 'hide root folder' option in web.config - then you can have as many folders in the root as you like - without them forming part of the url.

umbracoHideTopLevelNodeFromPath Causes the top level content items to be excluded from any url paths. For example, this is pre-set to True, so:

[Content]Home = /home.aspx or /home/

[Content]Home\Projects = /projects.aspx or /projects/

[Content]Footer\Page1 = /page1.aspx or /page1/

[Content]Home\Projects\About = /projects/about.aspx or /projects/about/

http://our.umbraco.org/wiki/reference/webconfig

Secondly there are four 'hidden' redirect fields on every umbraco node (which you can add into the document type) which can change the url routing:

  • umbracoRedirect (content picker) - Umbraco will redirect to the picked page
  • umbracoInternalRedirectId (content picker) - Umbraco will load the picked page without changing the url
  • umbracoUrlName (textstring) - Umbraco will override the page’s default url
  • umbracoUrlAlias (textstring) - You can have several urls for the same page (not sure when this is useful)

So I guess in your scenario umbracoUrlName will pick out a page in your combined folder but with a url that you choose.

So you have

homepage 
|- footer
   |-page1 (umbracoUrl = "/footer-page1/")

and /footer-page1/ would render your page stored in the footer folder.

You could also hack things about and make umbracoRedirect & umbracoInternalRedirectId work but I'm not sure that it would help.

Bobine answered 12/5, 2013 at 19:1 Comment(4)
Thanks, I see I've been trying to do it a slightly different way. I was trying to avoid the manual umbracoUrlName for each page. Sitting them in folders in the root looks quite a neat solution.Zibeline
HTH A good pattern I've found is to put all the content under the home node with this setting - and then you can have not-visible-pages content management (eg pod maintenance) in the content tree.Bobine
I couldnot find UmbracoUrlName in data types, im using umbraco 6.1.5 ? is anything wrong with this version?Eustazio
This helped me solve the bizarre problem on a new site setup whereby child items weren't inheriting the parent folder name as part of their URL - turned out umbracoHideTopLevelNodeFromPath was set to true by default! Thanks.River

© 2022 - 2024 — McMap. All rights reserved.