designcity/silverstripe-sitemap3

A package that creates a sitemap based on your Silverstripe SiteTree. Includes optional themes, filtering options and accessibility markup.

Installs: 429

Dependents: 0

Suggesters: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 2

Type:silverstripe-module

dev-master 2017-02-15 04:31 UTC

README

#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.

##Requirements

  • Silverstripe ~3.1

##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:

SiteMapPage:
	#Default theme
	theme: default
	#Slickmap-based theme
	theme: slickmap

##Example Usage

Example config.yml file in your project root

---
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

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.

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.

##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.

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.

##Installing with Composer Run from project root

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.