Sunday, February 27, 2011

Nested List Sitemap From a Flat XML File

I needed to build a Sitemap where each sub-level is indented more than the top levels...a very typical sitemap. However, my XML file was not in the order it needed to be output to the page and it was a flat XML file, so I couldn't pull the hierarchy from the XML.

I decided to do a template for each level of the sitemap and trigger each template recursively at each level till no more items were available on the level.

It took about 15 hours of staring at code that didn't work till I got it right.

Here is my solution:

Nested Sitemap from a Flat XML File

No comments:

Post a Comment