Site map module for Silverstripe 3.1
Description
Dynamically generates a SiteMap tree for a silverstripe website. Offers alternate display themes, page filtering options and accessibility markup., (*1)
Requirements
Themes
The sitemap has multiple themes. The default theme focuses on generating an accessible, simple sitemap. The other included theme, Slickmap, is based on Astuteo's Slickmap css, (https://www.astuteo.com/slickmap/) and provides a more visual representation of the site layout.
Respectively, you can use each theme by changing the config.yml:, (*2)
SiteMapPage:
#Default theme
theme: default
#Slickmap-based theme
theme: slickmap
Example Usage
Example config.yml file in your project root, (*3)
---
Name: {projectconfig}
---
SiteMapPage:
#Determines what Pages to not display
hidefrommap:
#Checks each value against a Page's ClassName and does not display if it matches
ClassName:
- Terms&CondsPage
- SecretPage
#Hides everything that isn't shown in the menu
ShowInMenus: false
#Hide any Page with this particular title
Title: The Unmappable Page
Example SiteMapPage content, (*4)
This is the site's sitemap.
This and the line above are just flavour text
[SiteMap]
This line will appear after the generated SiteMap tree
Displaying Pages
By default, Pages are hidden from the site map by altering the config.yml values for SiteMapPage.
Anything under the 'hidefrommap' key is checked against a Page's properties and if the property value matches or is
in the config-set value, it is not displayed., (*5)
Be specific with what to hide; hiding a parent page will still cause it's children to be displayed. They will be inserted at the tree depthin which the parent would originally inhabit., (*6)
Extending
The module provides a function that can be overriden on each Page type, canSiteMap($member).
You can conceal Pages this way or add your own display functionality to the Page., (*7)
Another method, if you wish for direct descendants to retain the default functionality of canSiteMap(), is that you can
overwrite the result by extending the Page and implementing the updateCanSiteMap($member) function. This takes precedence over
canSiteMap() and can allow for specific functionality on select pages., (*8)
Installing with Composer
Run from project root, (*9)
composer require "designcity/silverstripe-sitemap3" "dev-master"
Adding themes
If you think you have a pretty tip-top theme, submit a pull request and we'll look at integrating it into the project., (*10)