Include & ampersand character in sitemap XML
In this post, I describe how to fix a sitemap error that can occur if an unescaped character such as an & (ampersand) is included in the sitemap.xml.
Cause
The error occurs because the sitemap is not UTF-8 encoded. In my case, I had a URL with an unescaped & (ampersand):
<url><loc>https://www.centrel-solutions.com/company/testimonial.aspx?directory=education&testimonial=education-the-shared-learning-trust</loc><changefreq>never</changefreq></url>
Resolution
To resolve the error, I used an entity escape code for the & (ampersand) character as per the sitemaps specification:
https://www.sitemaps.org/protocol.html
<url><loc>https://www.centrel-solutions.com/company/testimonial.aspx?directory=education&testimonial=education-the-shared-learning-trust</loc><changefreq>never</changefreq></url>
Validate
You can validate a sitemap here:
Comments
Post a Comment