Forum
Perch CMS documentation - Create a Google Sitemap
I followed the guide in the documentation to create a sitemap:
https://docs.grabaperch.com/perch/content/functions/how-do-i-create-a-google-sitemap/
It (sitemap.php) created a sitemap containing over 1,000 entries all for the root of the domain!
The documentation says to create sitemap.html as follows:
<perch:before><?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
</perch:before>
<url>
<loc>https://example.com<perch:pages id="pagePath"></loc>
</url>
<perch:after>
</urlset>
</perch:after>
<perch:pages id="pagePath"> didn't return anything, meaning all entries were <loc>https://example.com</loc>.
My eye spotted that there was no '/' at the end (before the '>'), so I changed it to <perch:pages id="pagePath" /> and hey presto the sitemap works as it should.
Hello Dave,
This is because you are using an older version of Perch. Tags in older versions required Perch tags to be self-closing
/>
. Since Perch 3.1, this is no longer required.The change is documented here: https://docs.grabaperch.com/templates/
It was also discussed in Perch's blog if you're interested in learning more: https://grabaperch.com/blog/archive/2018-03-26-template-changes-in-perch-3-1
Thanks for replying Hussein. I will have a look at those links.