q2a / question2answer

Question2Answer is a free and open source platform for Q&A sites, running on PHP/MySQL.
http://www.question2answer.org/
GNU General Public License v3.0
1.63k stars 627 forks source link

Sitemap.xml issues #965

Closed PELock closed 1 year ago

PELock commented 1 year ago

Some validators says you put invalid tags in XML sitemap

https://www.mysitemapgenerator.com/service/check.html

Error:

"All values in a Sitemap must be entity-escaped. Please check to make sure that your URLs follow the RFC-3986 standard for URIs, the RFC-3987 standard for IRIs, and the XML standard."

https://odzyskiwaniedanych.net.pl/tag/odzyskiwanie+danych

I also think you should trim out the priority to 2-3 places after period

<url>
<loc>https://odzyskiwaniedanych.net.pl/tag/arkusz+kalkulacyjny</loc>
<priority>0.33333333333333</priority>
</url>
pupi1985 commented 1 year ago

Regarding the plus sign, it shouldn't be there. It's a bit picky, IMO, but it is true that's a bug. This PR should fix it: https://github.com/q2a/question2answer/pull/966

Regarding the priority length, there is nothing in the protocol definition that states any length.

Regarding priority 1 being invalid (I'm getting that error from that validator) that's a bug in the validator. Some reference links:

I also took the example sitemap from the official page:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.example.com/</loc>
      <lastmod>2005-01-01</lastmod>
      <changefreq>monthly</changefreq>
      <priority>0.8</priority>
   </url>
</urlset> 

And I got this error from the validator:

XML Sitemap must begin with an opening <urlset> tag which includes the namespace (protocol standard) declaration, and end with a closing </urlset> tag.

>

So the validator is buggy. I advise you to use other validators.

PELock commented 1 year ago

Thank you :)