Jump to main content Jump to doc navigation

GoogleSiteMap Snippet

This snippet displays a Google Sitemap.

Usage

Simply place the snippet in the Resource you want to use, and set the Resource's Template to 'blank':

[[!GoogleSiteMap]]

Don't forget to set the content type to 'xml'.

Properties

Name Description Default Value
allowedtemplates A comma-separated list of Template IDs to filter by. Will only filter if a value is set.
containerTpl The Chunk to use for the output container. gContainer
context Limit to the specified Context(s). If empty, will grab Resources from current Context. Defaults to empty, can support a comma-separated list.
excludeResources An optional comma-separated list of Resources to skip.
googleSchema The location of the GoogleSiteMap schema. http://www.google.com/schemas/sitemap/0.9
hideDeleted If true, will show only nondeleted Resources. 1
itemTpl The Chunk to use for each result item. gItem
maxDepth The depth down the tree to grab Resources. If set to empty or 0, will grab all depths. 0
published If true, will only show published resources. 1
searchable If true, will only show searchable resources. 1
showHidden If true, will include hidden Resources. false
sortBy The field to sort the results by. menuindex
sortByAlias The class to use as the alias for the sortBy property. modResource
sortDir The direction to sort in. ASC
templateFilter The modTemplate column to filter by. id
where A JSON-style expression or array of criteria to select/filter resources to output. See xpdoquery.where for more detail. Somewhere is a bug, that doesn't show up anything for resources in containers.

GoogleSiteMap Chunks

There are 2 chunks that are processed in GoogleSiteMap. Their corresponding parameters are:

  • itemTpl - The Chunk to use for each result listed.
  • containerTpl - The Chunk to use for wrapping the results.

Examples

Display a sitemap for the current context:

[[!GoogleSiteMap]]

Display a sitemap that combines both the web and marketing contexts:

[[!GoogleSiteMap? &context=`web,marketing`]]

Limit the sitemap to only the Resources with Template named 'BlogTemplate', and exclude the Resources with IDs 123 or 78:

[[!GoogleSiteMap?
    &allowedtemplates=`BlogTemplate`
    &templateFilter=`templatename`
    &excludeResources=`123,78`
]]

See Also

  1. GoogleSiteMap.GoogleSiteMap
    1. GoogleSiteMap.GoogleSiteMap.containerTpl
    2. GoogleSiteMap.GoogleSiteMap.itemTpl

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • Lefthandmedia
  • Murray Wood
  • eydolan
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$301 per month—let's make that $500!

Learn more