
Creating an XML Sitemap in MODx
MODx offers site owners a variety of Extra (packages) that can be used to build an XML Sitemaps. Today we are going to use quickly create a sitemap using the extra named GoogleSiteMap written by YJ Tso and Garry Nutting. Configuring your sitemap should only take a few minutes.
Download MODx Extra: GoogleSiteMap

- Log into your manager account
- From the top navigation, select Extras Installer
- Click Download Extras
- Search for: "GoogleSiteMap"
- Download the package titled: GoogleSiteMap (authored by sepiariver)
- Click Back to Package Management
- Install the package
- The Details will appear, click Continue to start the install
- Confirm that no errors occurred during installation, then select Ok
Selecting the Best Version of GoogleSiteMap
Once GoogleSiteMap is installed, two Snippets can be called to build your sitemap.
- GoogleSiteMap is the is the more modern and faster snippet. The downside of the faster load time is that some of the customizable properties are removed.
- GoogleSiteMapVersion1 is the legacy snippet. It can take longer to load but it gives you the ability to narrow down the pages listed in the sitemap.
Building a XML File in MODx
A XML file is need to be created to house the sitemap. The process is very similar to creating a regular file, except you'll need to alter the template and content type.
- Create a new document off of the root directory
- Name your file (example: sitemap)
- Change the Template: (empty)
- In Settings, change Content Type: XML
- Save the file
Connecting GoogleSiteMap to a XML File
In our new XML file, simply call the snippet you would like to use. I like to call it uncached as the file will change as your site grows. To achieve this prepend an exclamation point '!' to the the snippet name. Once complete save your file and view it to confirm it is working.
[[!GoogleSiteMap]]
[[!GoogleSiteMapVersion1]]
Custom Properties
Custom properties can be used to narrow down the pages in your sitemap. You'll want to make sure you aren't submitting your 404-page, files behind a login wall, or other files you wouldn't want to be indexed. The properties for the sitemap can be found on the properties tab of the snippet.
Creating a Custom Property Set
When making changes to the default properties, it is recommended to create a custom property set. This ensures you always have a copy of the default properties on hand.

- Navigate to snippets. Elements Snippets GoogleSiteMap
- Select either GoogleSiteMap or GoogleSiteMapVersion1
- Select Properties
- Then Add Property Set
- Check "Create New Property Set"
- Name your property set and give it a brief description
- Click Save
- Select your property set in the dropdown next to "Add Property Set"
- {Make your updates to the properties}
- Select Save Property Set
- Finally select Save at the top
Calling Your Property Set
To attach the property set to your snippet, append an @ to the end of the snippet. Then directly after the @ enter the property name.
[[!GoogleSiteMap@MyPropertyName]]
Properties: GoogleSiteMap
Property | Type | Default |
---|---|---|
cacheExpires | Textfield | 86400 |
cachePartition | Textfield | googlesitemap |
cachePrefix | Textfield | googlesitemap |
containerTpl | Textfield | gContainer |
context | Textfield | |
googleSchema | Textfield | http://www.sitemaps.org/schemas/sitemap/0.9 |
hideDeleted | Yes/No | Yes |
legacyProps | Textfield | allowedtemplates, excludeResources, excludeChildrenOf, sortByAlias, templateFilter, itemTpl, maxDepth, startId, where |
legacySnippet | Textfield | GoogleSiteMapVersion1 |
priorityTV | Textfield | |
published | Yes/No | Yes |
searchable | Yes/No | Yes |
showHidden | Yes/No | No |
sortBy | Textfield | menuindex |
sortDir | Textfield | ASC |
Properties: GoogleSiteMapVersion1
Property | Type | Default |
---|---|---|
allowedtemplates | Textfield | |
containerTpl | Textfield | gContainer |
context | Textfield | |
excludeChildrenOf | Textfield | |
excludeResources | Textfield | |
googleSchema | Textfield | http://www.sitemaps.org/schemas/sitemap/0.9 |
hideDeleted | Yes/No | Yes |
itemTpl | Textfield | gItem |
maxDepth | Textfield | 0 |
priorityTV | Textfield | |
published | Yes/No | Yes |
searchable | Yes/No | Yes |
showHidden | Yes/No | No |
sortBy | Textfield | menuindex |
sortByAlias | Textfield | modResource |
sortDir | Textfield | ASC |
startId | Textfield | 0 |
templateFilter | Textfield | id |
where | Textfield |