hi,
I have a problem with my multilingual sitemap , the main language (‘fr’ here) sitemap does not display the canonical url : see https://www.productivix.com/fr/sitemap.xml displays Urls as https://www.productivix.com/about/
instead of :
https://www.productivix.com/fr/about/
The other sitemaps for “en” , “de” are well
The hugo.toml parts for that are :
[sitemap]
changefreq = "weekly"
priority = 0.5
filename = "sitemap.xml"
theme = 'ananke'
#####Languages####
defaultContentLanguage = 'fr'
#defaultContentLanguageInSubdir = true // no because the 404 page does not display
So Google Search Console tells me that my /fr pages given are not canonical
What should I modify please ?
thank you for your help
the only solution I found was to activate in hugo.toml :
defaultContentLanguageInSubdir = true
In you site configuration, theme and defaultContentLanguage belong in the root table, not under the sitemap table.
You might want to look at the TOML guide:
https://toml.io/en/v1.0.0
ah yes , sorry it was in this order (I just picked up some parts) :
theme = 'ananke'
#####Languages####
defaultContentLanguage = 'fr'
[sitemap]
changefreq = "weekly"
priority = 0.5
filename = "sitemap.xml"
You are telling Hugo to publish the ‘fr’ pages to the root of the public directory, so that is their canonical location.
I do not understand well your answer. You mean that the parameters I wrote ask Hugo to do so.
Yes I do imagine, but it is not recommended in fact for the SEO.
I mean Google saw that the ‘/fr/add’ is the canonical for ‘/add’ ( I do not know how…) , so that is to be avoided.
Is the solution to activate in hugo.toml :
defaultContentLanguageInSubdir = true
?
It works now in test of the site , and I have no more problems with the 404 pages as beginning of that month.
If you want the fr site served from https://example.org/fr/, then set defaultContentLanguageInSubdir to true.