In the Loupe

Statamic Sitemap in Sixty Seconds

Statamic Sitemap in Sixty Seconds Featured Image

Sitemaps are probably the last checkbox ticked before launching your new site. Thankfully with Statamic it takes less than a minute to complete this task.

Download the Statamic plugin called Plugin-Sitemap by Max Westen.

After downloading, place the “pi.sitemap.php” file in a folder called “sitemap” and drop it into your “_addons” folder. You won’t need the files in the content, layouts and content folders.

Create a layout file in your theme called “sitemap.html”. Drop this code in there:

<urlset xmlns="">
{{ sitemap }}
  <loc>{{ loc }}</loc>
  <lastmod>{{ lastmod }}</lastmod>
  <changefreq>{{ changefreq }}</changefreq>
  <priority>{{ priority }}</priority>
{{ /sitemap }}

To tell Statamic what to do with your “sitemap” slug. In your _config > routes.yaml file add:

    layout: sitemap

Lastly, tell the search engines where to find your sitemap. In the root of your website, add a robots.txt file. My site’s robot.txt file looks like this:


User-agent: *



If you don’t want to wait for Google to find your robots.txt file, submit your sitemap to Google Webmaster Tools and Bing Webmaster Tools.