Reputation: 551
I am working with Umbraco and was wondering whether there is a easy way to create a site wise settings node.
At the moment I have this tree structure.
What I would like to create is something like this
Site Wide Content will contain something like Google Analytics Url, that the user can change easily.
Is there a way to accomplish this?
Upvotes: 3
Views: 2326
Reputation: 2316
EDIT: See bottom for a method for handling page redirects and 404 errors resulting from templateless nodes...
A common node structure may look like this which allows for site specific content - the advantage here is that all the site content resides under the home node and users can't create more content in the root (provided you've set things up properly):
Depending on how much site wide settings information, you could create a Settings tab on the Home DocumentType and store it all there (as illustrated above); or create a tree structure using a Settings node (as illustrated below):
Alternatively, for Global Settings/Content (where I might have multiple sites) I frequently create a separate node structure at the root to contain global settings, email templates, etc.:
Create a Settings DocumentType to act as a folder or container, but don't give it a template and all your global/site-wide settings/data content can be organised under that.
DocumentTypes that are created without assigning/creating a Template for them (as in the case of say the Section node at the base level of the tree and it's children) will throw a 404 error when someone attempts to visit it's URL, and thus should be excluded from any navigation rendered in the website. Any user manually entering the URL that you would expect to find the node at, e.g. /settings will be presented with the default 404 error page as it doesn't exist.
There are a few ways to mitigate this:
Add a property to the DocumentType with the alias umbracoRedirect
and using the ContentPicker
DataType;
Create a custom 404 Error page and set up the Umbraco configuration to use that instead of the default.
If you use the first option, you can set the page that you want the user to see by default - generally the Home page.
The second option can be good if you have some custom logic (like finding closest matching page based on URL) in your 404 error page, or use something like SEO Checker to handle 404 errors and redirects for you.
A lot of this is mitigated by simply making sure those nodes aren't visible via their URL in the website at all, which can be done by coding your navigation structures (menu's, sitemaps, etc.) to exclude them.
Note: I generally make sure they are also excluded by any sitemap.xml generators so that search engines don't attempt to index them. You can also add them to your robots.txt files as well.
Upvotes: 8