Copied to clipboard

Flag this post as spam?

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


  • Gavin 7 posts 37 karma points
    Jun 20, 2013 @ 16:32
    Gavin
    0

    Stop document types rendering website pages

    Hi

    Building our first site in Umbraco site (6 - MVC) and having trouble finding a way to stop certain document types physically rendering as pages within the website.

    As part of the site structure we have generated new document types purely to be inherited by the parent for content generation to maintain layout and flexibility (so any number of items can be created and loaded into a page).

    At present each one still generates its own page on the website although without a template assigned currently just getting an Umbraco error page.

    Is there anything that can be done to treat certain document types as data entry only?

    Have tried looking on the forums but have yet to come across anything similar

    Thanks for any help

    Gav

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 20, 2013 @ 17:16
    David Brendel
    0

    Hi,

    what did you mean by "generates own page"?

    Umbraco doesn't care about documenttypes beeing used as data entry only, so it generates links to every documenttype. That said you can prevent documenttypes from beeing rendered in your website menue. For that you can add a true/false property with the alias umbracoNaviHide to your documenttypes.

    If you build your menue within the views with razor you can do something like: Model.Children.Where(x => x.IsVisible) to get all documenttypes that should be visible.

    Is that what you meant?

     

  • Gavin 7 posts 37 karma points
    Jun 20, 2013 @ 17:30
    Gavin
    0

    Hi David, 

    Sorry was not clear enough, under the page/document properties tab it still creates 'Link to document' which is what I am referring to.

    Whilst the site does not have any links going to them my concern is around these being stumbled upon whether by robots or users - so thinking the same 404 page would serve both these pages and those that actually do not exist.

    Unless I am missunderstanding Umbraco error pages and both infact are served the same way?

    Hope this clarifies - thanks for your help.

  • Josiah D Thoen 18 posts 63 karma points
    Jun 24, 2013 @ 04:18
    Josiah D Thoen
    0

    Each content node has a url.  I am not aware of any way to prevent that.  If the node does not have a template it will render as a 404 file not found error.  You can create your own 404 for these pages cref:  http://our.umbraco.org/wiki/install-and-setup/configuring-404-pages or  http://our.umbraco.org/wiki/how-tos/how-to-implement-your-own-404-handler

    Keep in mind a bot will only go to urls that are exposed via a link either internal or external.  User could stumble upon a "data only" node however they would have to be manually entering in random urls unless you expose them through a link.  So, if they get a 404 then thats their fault.

  • Funka! 398 posts 661 karma points
    Jun 24, 2013 @ 20:33
    Funka!
    1

    Gavin, what Josiah wrote is totally correct but for further re-assurance, you can use a site scanning/spidering tool (my favorite is Xenu) to ensure that your site is not generating any links to these non-existent pages.You could also use Google Webmaster Tools after it's had some time to index your site to look for these same types of problems. This is a great recommended practice for all kinds of sites, not just Umbraco ones!

    Also, if you have various content editors working on the site, you will need to train them that they are not supposed to click on these links to preview these "pages". We still get periodic phone calls from people doing this who then worry needlessly why they are getting an error page, and why have to explain to them again that there is nothing wrong. There was a feature request to change this behavior over at U4-862 but I'm unsure of whether it will ever get any more attention.

    Best of luck to you!

  • Josiah D Thoen 18 posts 63 karma points
    Jun 25, 2013 @ 03:16
    Josiah D Thoen
    0

    The other solution I have used is to do a Response.Redirect or the like in the template of the "data nodes".  Redirect up to one of the parent nodes.  If you program query string parameters into it you can code the parent page to display the content for original child node where applicable.

  • Gavin 7 posts 37 karma points
    Jun 25, 2013 @ 10:12
    Gavin
    0

    Thanks for the information - as it has been said, not so much an issue from SEO, guess more me trying to keep things tidy.

    The other problem this was causing is the site search trying to go to these new doc types but showing the 404, but i'll look into Josiah's re-direct idea as a solution

    Thanks for your help.

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 25, 2013 @ 10:20
    David Brendel
    0

    If you do your own Examine search you can handle that the search tries to go to that pages by adjusting the links of the display search results.

    Or you can exclude them from the search. Depends on what you want.

    I think that should be a acceptable solution for the search problem.

  • Gavin 7 posts 37 karma points
    Jun 25, 2013 @ 11:26
    Gavin
    0

    Yeah, im just running an if statment to test against certain doctypes and if a result directs to one that we dont want to be 'visible' will show the } else { <a> pointing at the parent.

    Just trying to figure out how to find the parent, from searching forums its seems '@node.Parent.Id' is no longer viable...

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 25, 2013 @ 11:48
    David Brendel
    0

    I think node.Parent.Id should work in the new and the old razor. I'm not aware of any changes that this doesn't work anymore.

  • Gavin 7 posts 37 karma points
    Jun 26, 2013 @ 12:09
    Gavin
    0

    Strange as im getting a server error 

    "'Examine.SearchResult' does not contain a definition for 'Parent' and no extension method 'Parent' accepting a first argument of type 'Examine.SearchResult' could be found (are you missing a using directive or an assembly reference?)"

    @item.Parent.Id

    Does this highlight anything that I could be missing?

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 26, 2013 @ 12:25
    David Brendel
    100

    The SearchResult from examine is not a normal node.

    From a search result you can ty to get the node by doing Library.NodeById(item.Fields["id"]) with the old razor or Umbraco.TypedContent(item.Fields["id"]) with the new razor. After this you got a node from which you can access the parent id by using .Parent.Id.

    Try that , i think this should work.

  • Gavin 7 posts 37 karma points
    Jun 26, 2013 @ 12:34
    Gavin
    0

    That's done it! Thanks.

    Do like Umbraco when things work, just seems difficult to find tutorials/information amongst the different versions of code versions at the moment.

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 26, 2013 @ 15:51
    David Brendel
    0

    Glad i could help.

    I know what you meen, it's sometimes somewhat confusing. Needs some time to get the differences.

    If you want then mark the answer so it's visible in the forum that this topic is solved.

Please Sign in or register to post replies

Write your reply to:

Draft