+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Google XML Sitemap and DenyAnonymous

Google XML Sitemap and DenyAnonymous

2 posts, 0 answered
  1. Vaughn
    Vaughn avatar
    8 posts
    Registered:
    21 Oct 2010
    18 Feb 2011
    Link to this post
    I have implemented the xml sitemap code posted by Duncan Evans here, which is working great thus far. I wanted to make a minor change of allowing non-navigable pages, and disallowing non-public pages. So I changed the code from:

    // process each sub page
    foreach (CmsPage cmsPage in page.ChildPages)
    {
        if (page.Navigable == true)  
        {
            AppendNode(cmsPage, writer, subNodeDepth);
        }
    }

    To:

    // process each sub page 
    foreach (CmsPage cmsPage in page.ChildPages)
    {
        //if (page.Navigable == true)   Don't care if it's navigable
        if (page.DenyAnonymous == false)  // Check that its public only
        {
            AppendNode(cmsPage, writer, subNodeDepth);
        }
    }

    This does not work as expected though...  I suspect pages who inherit their DenyAnonymous status from a parent are not set DenyAnoymous themselves in the DB. The result is that my "members-only" pages still show in my sitemap, which is not ideal.

    Can someone suggest code that would check for both explicit and inherited DenyAnonymous = True?

    Thanks,

    Vaughn

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    22 Feb 2011
    Link to this post
    Hi Vaughn,

    You are right - child pages inherit from their parent, unless you click on break inheritance in the administration. If you don't want to break the inheritance you can do either one of these:
    - Find the parent, and check it's property
    - Calculate the effective security roots of that page.

    Greetings,
    Georgi
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
2 posts, 0 answered