New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sitemap.xml as a plain text - bug in declaration in urlset #10515
Comments
The problem is a 301 redirect with:
|
The default sitemap template for sitemap.xml in Hugo contain
Changing it just to
adding the way of displaying sitemaps in subfolders exactly like the root one. As mentioned here: but then Google Search Console will start complaining about Incorrect namespace. Firstly it's better to think if we need to fix that. I don't think we need it. Google search engines are reading these files, not users. I understand that users may want to preview that, but overall I am sticking with defaults. |
@idarek The PR I submitted (#10516) fixes this trivial redirect problem, and adheres to both the sitemap protocol and Google's recommendations for multilingual sites. |
Work on both on my end. I copied templates from Hugo GitHub repo and created in my layout all works fine now. |
I agree. Given that the host + path is unique, I incorrectly assumed that the protocol was irrelevant. Looking at the spec, it is indeed a full string comparison. John Mueller of Google, in this thread, states:
But just because Google does, it does not mean that everyone else does. I will revert 3fd0b78. In the future, please open a new issue instead of commenting on a commit or a closed issue. Thanks. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
I found bug in default sitemap template (for multilingial sites)
After generate sitemap (i.e https://example.org/en/sitemap.xml) and open it in browser - you see xml as a plain text, because urlset declaration is not valid
Solution
You need add to sitemap.xml template in urlset tag this declarations:
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.w3.org/TR/xhtml11/xhtml11_schema.html http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/TR/xhtml11/xhtml11_schema.html">
The text was updated successfully, but these errors were encountered: