Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stefan 117 posts 215 karma points
    Aug 16, 2013 @ 22:50
    Stefan
    0

    Preventing certain content node types from being rendered (accessed)

    I'm currently building a multilingual site in Umbraco using a multi-site structure, where each language is represented with a subtree in the content tree.

    Now I'm in the process of planning how to add sidebar widgets to the site. It must be possible to add individual widgets for each language (subtree) of the site, which is why I have choosen to create a SidebarContainer documenttype to contain all SidebarWidgets. The SidebarContainer is rooted as a node in each language subtree.

    As far as I see this solution, it makes it easy to maintain and add widgets independently for each language, and then I can use a control (as for example uComponents MNTP) to select the nodes on each content node that have sidebar widgets.

    My problem is that I don't want the nodes to be rendered, indexed or searched (using XSLTsearch). It should for example not be possible to access www.mysite.com/sidebar/widget1.
    Can this be done globally, or do I need to manually make the required precautions for each place I don't want the node to be found (editing xsltsearch.xslt, making redirects for www.mysite.com/widgets/* and so on)?
  • Stefan 117 posts 215 karma points
    Aug 17, 2013 @ 02:41
    Stefan
    100

    Nevermind. I have chosen a little different approach.

    I have created two new container documenttypes, SidebarContainer and SidebarLanguage, where SidebarContainer is located outside the content-tree. I use an XPATH expression with Multi-Node Tree Picker to be able to select and sort each widget that is located beneth the SidebarLanguage type. Then each type of widget is simply given their own documenttype to be able to differentiate between them.

    On every page where widgets are available, an XSLT macro is added. The code for the macro iterates through each node picked with MNTP and then applies the appropriate template to the selection. 

    Works as I want since the "dummy" nodes not are rooted inside the actual content-tree. Only minor drawback is that content editors can add any given widget to any given language node (because of the multi-site structure).

    I hope this little explanation can be of any help to others :)

  • andrew shearer 399 posts 504 karma points
    Aug 18, 2013 @ 08:07
    andrew shearer
    0

    what version of Umbraco? if you don't specify a Template on a content node then it should return a 404 if you access the Url.

  • Stefan 117 posts 215 karma points
    Aug 19, 2013 @ 12:52
    Stefan
    0

    Version 6.1.3. I do know about not specifying a template on a content node, but that doesnt prevent extensions like XSLTsearch from indexing the node.

Please Sign in or register to post replies

Write your reply to:

Draft