Umbraco routing not working outside Home node

Viewed 204

To reproduce the issue create the following hierarchy:

  • Content
    • Home
      • Foo
        • Bar - The published URL will be <domain>/foo/bar
    • Foo
      • Bar - The published URLwill be <domain>/bar

Why does umbraco skip /foo/ when creating a page outside of Home? Is there a way to make nodes outside of Home stack the path as the nodes under Home?

Umbraco v7

2 Answers

Home is your root node so / will show your home page and /foo/ will show the home>foo page.

The only way to show nodes under the root foo node is to provide a hostname on the root foo node using 'culture and hostnames'

Obviously once you do that, you will also have to set that hostname up as a binding on the same website in iis as well.

It would probably also be good practice to set a hostname for the home node as well if you add one for the foo node

I've managed to understand what's going on with the help from Umbraco community.

By default umbraco treats each child of Content as a root node aka home page. This is controlled by the following setting in web.config <add key="Umbraco.Core.HideTopLevelNodeFromPath" value="true" />

If I would extend my example by adding 3rd level like so: Content > Foo > Bar > Baz I would see that the published path of Baz is /bar/baz. Umbraco does stack the path but it removes the 1st level because it's considered the default route.

Related