Go to page content

Displaying a Sitemap

For the benefit of search engines and fans of tables of contents you can easily provide a site map.


Some users prefer to navigate a site based on its underlying structure.  Search engines also use this information to determine how pages relate to each other within your site.  For these cases it is useful to have a site map.


Readers are expected to know where templates go in a site and how they basically work.  To benefit the most you will also need experience in CSS to style the end-result effectively.


This is straight-forward except for the CSS (which isn't provided here), but that isn't entirely avoidable since it depends completely on how you want to display things.  On the other hand this does give you a workable nested unordered list with links to the pages which certainly serves the basic functionality OOTB.

Create site_map.tpl containing:

{% extends "page.tpl" %} 
{% block below_body %} 
    {% menu %} 
{% endblock %}

Create a dispatch rule to take /site-map to your Site Map page:

{site_map, ["site-map"], resource_page, [{template, "site_map.tpl"}, {id, page_site_map}]}

Create a Page with the Admin interface and set its Unique Name to page_site_map. Whatever you put in the body will show above the site map.

I haven't discussed CSS, but the menu is pretty CSS friendly. In Zotonic 0.7+ (maybe 0.6) you can have multiple menus which makes this kind of thing even more convenient :)


There are no troubleshooting steps available for this guide.  Please provide any you have learned in the comments below or on the Zotonic Users Group.

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.