Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Site Map Module in any template

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1310 Views
  • Graphicator
    Community Member
    62 Posts

    Site Map Module in any template Link to this post

    About a month ago, I noticed that sitemapmodule needed to be fixed for version 2.4 support. I'm glad they released a new version that supports 2.4

    I was wondering how to get SiteMap Module to display as a widget or somewhere in the sidebar. Or if there was a way to call $SiteMap?

    I also wanted to know if I could use $SiteMap anywhere in the template, as a default style, instead of the slick style, but keep the intended sitemap page as the slick style.

  • TotalNet
    Community Member
    181 Posts

    Re: Site Map Module in any template Link to this post

    Not in a literal sense AFAIK
    However, the functionality is quite easy to replicate.

    One way would be to use existing page controls and build your own in a template and include it just like you can with Navigation.ss
    Another way would be to add a method to your page class and re-use the code from Sitemap, either by copying code directly or calling SiteMapModule::Content() perhaps

    Essentially it's all an unordered list with a style sheet and some JavaSctipt to make it look nice, all of which is right there in the Sitemap module, you can probably do the whole thing with copy/paste.


  • DesignCity
    38 Posts

    Re: Site Map Module in any template Link to this post

    Greg - thanks for the email pointing to this forum post, otherwise I'd have never seen it!

    As Rich notes, the module hasn't really been designed to do that, but the functionality is easy to replicate.

    A couple of thoughts, firstly http://doc.silverstripe.org/tutorial:site-map has similar (older) code as the module, so you could copy the two functions SiteMap() and makeList($pages) onto your Page_Controller and access them using $SiteMap on any page. Add in the css that the tutorial describes and you're mostly there.

    If you're keen to have the Site Map Module working across the site, you can with a few changes.

    Firstly, open sitemapmodule/code/SiteMapModule.php and on lines 118 and 160, replace




    Secondly, create a new function on Page_Controller as follows:

       public function ShowSiteMapHere() {
          return SiteMapModule::Content();

    And from there you will be able to use $ShowSiteMapHere in your Page templates to show the site map. It won't affect your site map page at all, and you can swap the theme by changing the JS and CSS above to sitemap-slickmap.js and sitemap-slickmap.css respectively if you wanted.

    If there's a lot of community interest we could incorporate it into the module, but truthfully, I can't image there would be!

    Hope this helps

    Design City

  • bunheng
    Community Member
    78 Posts

    Re: Site Map Module in any template Link to this post


    I just created sitemap it working fine my local machine, but it show only page in parent position and page which I chose to display in menus, is there any possible way to display all pages in sitemap.


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.