SaaS CMS has officially launched! Learn more now.

Sitemap for the site


Hi All,

Can you please tell me how to generate  the Site Map for the EPi server driven web site. My requirement is this particular site map should contain links to all the existing pages and for the pages to be created. I mean this should be dynamic enough.

Please get back to me on this  as soon as possible.


Many thanks in advance.


Sep 24, 2009 17:14

Download a public templates pack - for instance this one, which contains a very basic site map example:

Hope it helps,

Sep 24, 2009 20:57

Hi Marten,


Thansk for your repply. I managed to get the Sitemap using page tree. But i have one problem.

We are using menu list for top menu on the site. The top menu was rendering the pages from right to left. So, our tema have given the sort index in teh reverse order and now the top menu is working fine. But the pages in the Sietmap are getting in reverse order. Cna you please suggest a solution for this.


Many Thanks

Sep 25, 2009 11:28

One way could be to hook into the Filter event of the control and rearrange the pages in the collection (reverse the order). If I were you I would do this in the top menu rather than the sitemap since the top menu is what does not follow the "expected" behaviour. Also it's flat (not hierarchial) so it would be fewer pages and simpler logic.

Edit: I'm not sure if this will work, perhaps the order is set after the Filter event, but it's worth a try.

Edited, Sep 25, 2009 13:19
Could you please post me the code required for this change...i am new to EPi server  Frown
Sep 25, 2009 13:29

This is completely untested code. It also assumes that the order presented in the menulist is the order the pages are in the collection, i.e. that ordering is done before this event handler is called. In that lucky case you should just be able to create an eventhandler that looks something like the below and connect the Filter event of your MenuList to it (for example in markup by setting OnFilter="ReverseOrder"):

using System.Linq;

protected void ReverseOrder(object sender, EPiServer.Filters.FilterEventArgs e)
PageDataCollection reversed = (PageDataCollection)e.Pages.Reverse();
foreach (PageData p in reversed)

Edited, Sep 25, 2009 13:41
Thanks Magnus, will implement it and will let you know the out put.
Sep 25, 2009 14:33

Hi Magnus,

The above code worked with some midifications.  Thanks for your favourable help. Below is the modified code.

Thanks Again.


PageDataCollection correctPageOrder = (PageDataCollection)e.Pages;
PageDataCollection reversePageOrder = new PageDataCollection(e.Pages.Count);

for (int i = e.Pages.Count-1; i >= 0; i--)

foreach (PageData p in reversePageOrder)


Sep 25, 2009 15:03
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.