Skip to content
  1. Extras
  2. cityFields
  3. Sitemap generation

Sitemap generation

If you use subdomains or subdirectories for cities, you need to generate a correct sitemap.xml. Create a page in the manager with these parameters:

  • Template: empty
  • Alias: sitemap
  • Content type: XML
  • Content:
modx
[[!pdoSitemap?
  &cache=`0`
  &scheme=`-1`
  &tpl=`tpl.Sitemap`
]]

Sitemap page

Since INLINE chunks cannot use modifiers and conditions, also create a chunk tpl.Sitemap with this content:

modx
<url>
<loc>[[!+cf.current_city.url]]{$url != '/' ? $url : ''}</loc>
<lastmod>[[+date]]</lastmod>
<changefreq>[[+update]]</changefreq>
<priority>[[+priority]]</priority>
</url>

Thus a sitemap.xml will be generated for each subdomain or subdirectory.