1

I am trying to generate a sitemap.xml file of all the pages that are published to the Broker. Can this be achieved if I use the content delivery API? Can I recursively traverse through the SGs and pages to get the URL of the page?

4

There is a good article by Nickoli Roussakov that pretty much gives you the code you need to generate a sitemap file by traversing through SGs and Pages. You simply need to add a TBB to your Page Template which will generate your sitemap.

However, in most cases, business rules tend to handle other logic through Page or SG Metadata which can be appended as attributes to each siteMapNode. But, to do this you will need to extend the code to meet your needs.

On a side note, I'd just like to add (depending on the amount of SGs and Pages you have), the sitemap xml file could become really large, becoming quite time consuming to publish as you will be updating the file on every publish/unpublish. Assuming you haven't yet decided on an approach to take, I would have a read of this post which discusses alternative ways to generate a sitemap.

  • thank you for your response.I already have the C# TBB which does that. But i am looking to generate the file using CD API. – Vandana May 23 '14 at 17:01
3

If you're looking to build navigation on the content delivery side, I'd recommend using odata to query for the structure groups, for example:

http://{ODATA-SITE}//odata.svc/StructureGroups?$filter=PublicationId%20eq%300

Note: {ODATA-SITE} and 300 are values that you would need to change that are relevant to your implementation.

  • I am not looking to build navigation here, but build an XML file that has all the url's of the pages that are published to broker. This file should be country specific for ex, US should generate the file in US folder and Fr should generate it in FR folder. – Vandana May 23 '14 at 17:03
  • If you have the native broker API installed on your application, you can do the same thing as suggested in the answer, except there is not need to rely on odata. And since the approach describes how to get all the SGs and Pages you have the info you need to build your xml. – Nickoli Roussakov May 26 '14 at 2:52

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.