I have always wondered what the best practice would be if I always want to hide a child node. Let me give some examples:
I have a folder doctype with a child doctype which contains a content picker that would pick pages to be showed in a menu. Like this: - Top Menu (TopMenu) -- About (TopMenuLinks - contains the content picker) -- Contact (TopMenuLinks - contains the content picker)
The nodes that are picked from the child would then be available at /topmenu/child when I only want the nodes to render a menu. I know how to use the umbracoNaviHide property, and I dont think that is the proper way of doing it.
Another example would be if I have a child doctype in my textpages. Lets say it is used to add employees to an about page. then you can navigate the employee at /about/my-employee which would query an empty template causing a 404 error.
Is there any specific reason why you want a rather static top menu, instead of generating it by listing text pages of a certain level? I can see that it in some cases can make sense but usually and by default I think the best approach is to have the menu generated dynamically.
You then have the option to avoid nodes being shown in the menu by - Hiding nodes on a certain level - Hiding nodes of a certain type - If the node has a template (I have never used this one, but should be possible to do however)
By doing so you can say that nodes from level 3 should not be included in your top-navigation - if I remember correctly that is somewhat similiar to the XSLT sample on the navigation prototype that can be selected in the developer section when creating a XSLT macro.
If you have nodes like Homepage, Textpage, Subpage and don't want the subpages to be displayed in any sort of navigation then you can simply exclude the document type called "Subpage".
If you have some "System" nodes where stuff like search, error 404 pages, checkout flows (if it's s shop) etc. can be defined it's rather simple to just exclude the "system" document type and it descendants.
In such a situation there will not be generated a link in the navigation bar to the "pages" since the XSLT has instructions to not include these in the output.
Picking nodes for the navigation by hand seems a bit cumbersome from my point of view and for the end user I think it will be a bit confusing to figure out why they need to include something in the main-navigation unless there is a clearly defined purpose on doing so.
Hope this inputs helps - and please don't hesitate to ask further questions or explain in more details what it is you're trying to do, in case I'm misunderstanding something :)
I think I get what you mean. But I would rather make sure that the nodes of the type shown are being excluded from the search instead, which can be done by either excluding the document type or simply adding af checkbox to decide wether or not it should be shown in the search.
From my point of view it does make sense to create a logical and helpfull structure and then create the neccessary renderings that behave as you expect.
You could also consider structuring your content differently so you have a central repository where you can create nodes like "Service", "Klargøring" etc, which makes sure it's not being searched and you can reuse the content snippets throughout the site.
You could for instance structure your site like this
Forside Biler Om os Vi udfører Kontakt Repository Forside billeder Billede 1 Billede 2 Etc. Statements Service Visuelle forbedringer Klargøring
That could solve some issues for you and with proper convention I'm sure it will also make more sense for the content editor, whom I suppose is a non-technical person who should be able to easily figure out how to keep the site updated.
Something like the above is what I would be doing rather having to pick the nodes that should make up the main navigation for this particular site :)
I have now excluded certain document types from XSLTsearch, which is working just fine.
That is helping me some of the way, but what if a page is indexed by a search engine and the visitors are sent directly to the page (that does not exist). Is it possible to add an url redirection, to send the visitor to the parent? And can you outline how this can be done?
If I did it like that instead of excluding certain document types, I would not have the problem with the content not being searchable, as if I excluded the document type from XSLTsearch.
Always hide child nodes
Hi.
I have always wondered what the best practice would be if I always want to hide a child node.
Let me give some examples:
I have a folder doctype with a child doctype which contains a content picker that would pick pages to be showed in a menu. Like this:
- Top Menu (TopMenu)
-- About (TopMenuLinks - contains the content picker)
-- Contact (TopMenuLinks - contains the content picker)
The nodes that are picked from the child would then be available at /topmenu/child when I only want the nodes to render a menu. I know how to use the umbracoNaviHide property, and I dont think that is the proper way of doing it.
Another example would be if I have a child doctype in my textpages. Lets say it is used to add employees to an about page. then you can navigate the employee at /about/my-employee which would query an empty template causing a 404 error.
How can this problem be avoided?
Thanks in advance!
Best regards
Stefan
Hi Stefan
Is there any specific reason why you want a rather static top menu, instead of generating it by listing text pages of a certain level? I can see that it in some cases can make sense but usually and by default I think the best approach is to have the menu generated dynamically.
You then have the option to avoid nodes being shown in the menu by
- Hiding nodes on a certain level
- Hiding nodes of a certain type
- If the node has a template (I have never used this one, but should be possible to do however)
By doing so you can say that nodes from level 3 should not be included in your top-navigation - if I remember correctly that is somewhat similiar to the XSLT sample on the navigation prototype that can be selected in the developer section when creating a XSLT macro.
If you have nodes like Homepage, Textpage, Subpage and don't want the subpages to be displayed in any sort of navigation then you can simply exclude the document type called "Subpage".
If you have some "System" nodes where stuff like search, error 404 pages, checkout flows (if it's s shop) etc. can be defined it's rather simple to just exclude the "system" document type and it descendants.
In such a situation there will not be generated a link in the navigation bar to the "pages" since the XSLT has instructions to not include these in the output.
Picking nodes for the navigation by hand seems a bit cumbersome from my point of view and for the end user I think it will be a bit confusing to figure out why they need to include something in the main-navigation unless there is a clearly defined purpose on doing so.
Hope this inputs helps - and please don't hesitate to ask further questions or explain in more details what it is you're trying to do, in case I'm misunderstanding something :)
/Jan
Thank you for your answer.
I'm aware of the limitations when doing so, but sometimes I still find it "clever" to use. If I eg. have textpages located in below various doctypes.
Examples could be:
- About the company (just a folder)
-- About us (textpage)
-- Our Values (textpage)
- Articles (just a folder)
-- How to... (how-to page)
Now, if users would like to have a menu with only the "About Us" and the "How to..." page, they could easily select those to be displayed in the menu.
I have a working example where I have done (almost the same), but with contents instead.
I hope this will explain it a little better:
http://www.screenr.com/5pos
Hi Stefan
I think I get what you mean. But I would rather make sure that the nodes of the type shown are being excluded from the search instead, which can be done by either excluding the document type or simply adding af checkbox to decide wether or not it should be shown in the search.
From my point of view it does make sense to create a logical and helpfull structure and then create the neccessary renderings that behave as you expect.
You could also consider structuring your content differently so you have a central repository where you can create nodes like "Service", "Klargøring" etc, which makes sure it's not being searched and you can reuse the content snippets throughout the site.
You could for instance structure your site like this
Forside
Biler
Om os
Vi udfører
Kontakt
Repository
Forside billeder
Billede 1
Billede 2
Etc.
Statements
Service
Visuelle forbedringer
Klargøring
That could solve some issues for you and with proper convention I'm sure it will also make more sense for the content editor, whom I suppose is a non-technical person who should be able to easily figure out how to keep the site updated.
Something like the above is what I would be doing rather having to pick the nodes that should make up the main navigation for this particular site :)
Hope it is of any use.
/Jan
Okay, now I see where you are going :)
I have now excluded certain document types from XSLTsearch, which is working just fine.
That is helping me some of the way, but what if a page is indexed by a search engine and the visitors are sent directly to the page (that does not exist).
Is it possible to add an url redirection, to send the visitor to the parent? And can you outline how this can be done?
If I did it like that instead of excluding certain document types, I would not have the problem with the content not being searchable, as if I excluded the document type from XSLTsearch.
is working on a reply...