When creating new top level pages in Umbraco, it seems I can create pages as children of my homepage or as siblings of my homepage. In either case the site seems to work fine and the urls of these pages are the same either way.
Is there a recommended way to structure a site regarding whether top level navigation items are children or siblings of the homepage?
You can have your pages side by side, but the general best practise is to nest them below the homepage for a couple of reasons:
1) Umbraco allows you to assign "host names" to a node so that you can actually host multiple sites from one install, this works by saying any request on a give node is routed to the node the hostname is setup on and any child page requests are filtered down to the children. By having 1 root node for a site, it allows you to do this, but if you had all your children on the root, you wouldn't be able to.
2) Another "best practise" people tend to do, is put site-wide settings on the root / homepage node which if you nest your child pages, you can easily traverse down the content tree and access them (eg: Model.Content.AncestorOrSelf(1).GetPropertyValue("someSitewideSetting")) where as if you have them all on the root, it wouldn't be that easy.
I'm sure there are more reasons, but I can't remember what they all are at the moment :) but I would suggest going with nested children as it will just give you more flexibility down the line.
Structure of top level content
When creating new top level pages in Umbraco, it seems I can create pages as children of my homepage or as siblings of my homepage. In either case the site seems to work fine and the urls of these pages are the same either way.
Is there a recommended way to structure a site regarding whether top level navigation items are children or siblings of the homepage?
Hi Andy,
You can have your pages side by side, but the general best practise is to nest them below the homepage for a couple of reasons:
1) Umbraco allows you to assign "host names" to a node so that you can actually host multiple sites from one install, this works by saying any request on a give node is routed to the node the hostname is setup on and any child page requests are filtered down to the children. By having 1 root node for a site, it allows you to do this, but if you had all your children on the root, you wouldn't be able to.
2) Another "best practise" people tend to do, is put site-wide settings on the root / homepage node which if you nest your child pages, you can easily traverse down the content tree and access them (eg: Model.Content.AncestorOrSelf(1).GetPropertyValue("someSitewideSetting")) where as if you have them all on the root, it wouldn't be that easy.
I'm sure there are more reasons, but I can't remember what they all are at the moment :) but I would suggest going with nested children as it will just give you more flexibility down the line.
Hope that helps
Matt
Hi Matt,
Thanks for your answer - that's really helpful!
Andy
is working on a reply...