Copied to clipboard

Flag this post as spam?

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


  • Sean Håkansson 61 posts 177 karma points
    Aug 22, 2015 @ 23:44
    Sean HÃ¥kansson
    0

    Exclude pages without templates from sitemap automatically

    Admittedly, this is a super lazy request.

    Instead of setting exclude from sitemap / document type in settings, it would be nice if this would be done automatically. I don't see any use cases where you would want to index a page without a template anyway?

    There is a "global" exclude naviHide from sitemap, however I find myself (navi)hiding pages where I do want subpages to be indexed, sometimes even the page itself (just not show up in the mainmenu, for example a cookie info page).

    Thanks

  • Peter Gregory 407 posts 1606 karma points MVP 3x admin c-trib
    Aug 22, 2015 @ 23:49
    Peter Gregory
    0

    Hey Sean

    Pretty simple to do in your Razor.

    var nav = Model.Content.Children.Where(x=>x.TemplateId > 0)
    

    This will return only pages that have a template set.

    EDIT: Oh just realised this is a request for SEO checker :P

  • Richard Soeteman 3815 posts 11824 karma points MVP
    Aug 24, 2015 @ 05:38
    Richard Soeteman
    0

    HI Sean,

    Sometimes people assign templates per request so I won't exclude by default. However you can exclude complete docutypes for the xml sitemap. That way those documents don't get included in the sitemap.

    Cheers,

    Richard

  • Sean Håkansson 61 posts 177 karma points
    Aug 24, 2015 @ 05:59
    Sean HÃ¥kansson
    0

    Oh yea, I never thought of that use case. Setting excludes on document types is not that hard, just a lazy mans request..

    At least "If you don't ask you don't get" :)

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft