3

In SDL Web 8.5 is it possible to export a list of all URLs in a specific tree?

We're hoping to use this to cross-check an XML sitemap to ensure nothing that's live isn't missed out (as crawlers won't index anything with a direct link to it).

Thank you,

8

There is no 'out of the box' way via the GUI, but you can do this using the Core Service.

Something like the following code (which outputs a CSV) should give you a good start:

void Main()
{
    List<PageData> allPages = Client.GetList("tcm:25-1234-4", new OrganizationalItemItemsFilterData { Recursive = true, ItemTypes = new[] { ItemType.Page } }).Cast<PageData>().ToList();    
    foreach (PageData page in allPages)
    {
        OutputPageDetails(page.Id);
    }
}

void OutputPageDetails(string pageId)
{
    PageData page = (PageData)Client.Read(pageId, null);
    string livePagePublishUrl = Client.GetPublishUrl(pageId, "Live");
    Console.WriteLine($"{pageId}, \"{page.Title}\", \"{livePagePublishUrl}\"");
}

(P.S. You'll probably want to consider using Client.GetListXML(), rather than Cleint.GetList() for efficiency)

  • Generally speaking, GetListXML is not more efficient than GetList (as a matter of fact, the first one internally calls the second and then builds the list XML). – Rick Pannekoek Mar 12 at 18:58
  • I assume the example TCM URI (tcm:25-1234-64) should actually be the ID (TCM URI or WebDAV URL) of a Publication rather than a Page ? – Rick Pannekoek Mar 12 at 19:01
  • Good point, Rick. It should’ve been the TcmId of a Structure Group where we’re starting from (rather than a page). I’ve updated it now – Jonathan Williams Mar 12 at 19:32
  • That’s interesting about ‘GetListXML()’ calling ‘GetList()’ internally. My concern was more about the amount of data coming ‘over the wire’ when working with a large list of objects (when using ‘GetList()’). I’ve never actually compared the two sizes though. – Jonathan Williams Mar 12 at 19:48
  • The amount of data for both types of lists can be optimized using the ListBaseColumns and AdditionalColumns properties of the list filter. In general, GetList results in so-called R6 XML going over the wire, whereas GetListXML results in R5 XML. The latter is older, but a bit more compact (it heavily uses XML attributes rather than nested XML elements). So, indeed, GetList will result in a bit more data sent over the wire, but in many situations this is neglectable. – Rick Pannekoek Mar 12 at 19:57
3

Actually Jonathan's answer is just part of the solution. You should create 2 lists:

  1. first list is the list created using Core Service API and this list is the list of URLs for pages that CM side thinks that are published.
  2. Second list is list of page URLs created using Content Delivery API, and this list is the list of actually published pages.

In ideal world, these 2 lists should be identical, but in most cases they are not. Second list is the list of actually published pages on CD Environment, so you should in any case do the following:

  • Create both lists
  • compare them and make sure that they are in sync (if there are some URLs in first but not in second list, republish the page so that it indeed comes to CD side. If there is URL in second, but not in first list, it means that item is orphan, so you should create undeploy package and remove it from CD environment).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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