We are using Tridion 2011 SP1. While generating site map XML in .NET templating code, we came across an issue. The requirement is to show only those structure group/pages in site map XML that are published against the publication target for which the site map xml is currently generated. For this we are using below API call.

PublishEngine.IsPublished(structureGroup, engine.PublishingContext.PublicationTarget, true);

The above call will be made against each structure group and page and hence is causing performance overhead in generating sitemap XML.

Is there any better way to achieve solution for above? For example: is there any API call available that accepts bulk structure group/page ids and return the publish status for them in a single shot?

  • Do keep in mind that Structure Groups are rarely published - you publish the pages within the SG, not the SG itself.
    – Nuno Linhares
    Commented Jul 8, 2013 at 15:34
  • Do you need to publish the navigation XML that often that it impacts everything else? Would you consider using dynamic linking instead?
    – Nuno Linhares
    Commented Jul 8, 2013 at 20:37

2 Answers 2


You can do something like this:

        Filter filter = new Filter();
        filter.Conditions["ItemType"] = 68;//pages, structure groups
        filter.BaseColumns = ListBaseColumns.Extended;

        XmlElement childItems = sg.GetListItems(filter);
        foreach (XmlElement item in childItems.SelectNodes("*"))
            string isPublished = item.GetAttribute("IsPublished");

Note, the Filter class is now deprecated, so you should switch this up for one of the new Filters, however, the concept is the same.

Have a look at the code here: http://www.tridiondeveloper.com/web-sitemap

The BaseColumns.Extended property loads the following additional properties when you call GetListItems(filter): IsPublished, IsShared, IsLocalized, SubType (for schemas: purpose, for template: template type), FileExt (file extension of multimedia data), Trustee (name of revisor). Only applies to ListItems.

For full descriptions of the properties see here (login required): http://sdllivecontent.sdl.com/LiveContent/content/en-US/SDL_Tridion_2011_SPONE/concept_10E4754436F449ED9E96518C50E23EDD

  • Thanks for the response. The above code works fine if there exists a single publication target for the tridion instance, as there is no mention of publication target against which the item(page/structuregroup) is published. Is there any way in above code snippet that I can pass publication target to filter the results?
    – TempTracer
    Commented Jul 8, 2013 at 16:41
  • For that you will need to use Engine, which you wanted to avoid. Commented Jul 8, 2013 at 16:45
  • Thanks, so there is no way to get the publishing status for batch of pages/structure groups in a single shot using API?
    – TempTracer
    Commented Jul 8, 2013 at 16:51
  • Unfortunately not. However, what you can do is implement a Child Sitemap feature. This way you can split up your site structure into several sitemap files which you can publish in separate threads. This should help with your performance issue. Commented Jul 8, 2013 at 17:10
  • Yes there is. Please see my answer. Commented Jul 10, 2013 at 21:45

I would look at leveraging Tridion's own resolving functionality. If you call StructureGroupResolver.Resolve() with a resolve instruction that uses ResolvePurpose.RePublish, you can get a list of pages that are currently published to the target in question. You can use this list to exclude non-published items from your sitemap.

  • Can you please show a more complete example of this approach? How would it work if we don't have any ResolveItems for an SG since we only have a list from GetListItems() of all pages and SGs, and what if the item in question is Page, not an SG? Commented Jul 10, 2013 at 21:58
  • If a republish resolve of the root structure group doesn't return any pages, then there are no pages published to your target in that publication. For a site map, you are really only interested in pages, not structure groups. Commented Jul 11, 2013 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.