getgrav / grav-plugin-sitemap

Grav Sitemap Plugin

Home Page:https://getgrav.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All languages on the same map: by default or not?

marcocevoli opened this issue · comments

I'm not sure if this is by design or not, but I'm pretty sure some months ago the HTML sitemap only showed the pages related to a single language, while the underlying XML was the complete map. Currently, I get ALL pages listed for all languages.
Right now I get the same sitemap representation for EN, IT and ES on https://qabiria.com/it/sitemap and https://qabiria.com/en/sitemap, etc. which might good for SEO, but not so good from a user point of view.
If this is due to a change in the code, would you consider adding an option to filter the map according to the current language?

As mentioned on Discord, this was the big update for the Sitemap v3.0 release. There were many issues and pull requests asking for 'proper' multilang support in Sitemap that followed the preferred (read Google's recommendation) for handling multiple languages via sitemaps.

The XML format of the sitemap is not intended for general user consumption, it's supposed to be used by search engines, and as such, should be in the most search-engine friendly format. That is now accomplished in version 3, but I can appreciate there are people that would like to use the 'old' format, especially in HTML format for an on-site sitemap listing. I will look into recreating this in some way, even though the primary goal of sitemap is to create the XML format that search engines can leverage for SEO.

I should mention that the simplest solution is to download the last 2.x version and do a "Tools" -> "Direct Install" with the zip.

https://github.com/getgrav/grav-plugin-sitemap/archive/2.0.2.zip

Thanks a lot for the detailed explanation. Indeed, I think there are 2 quite different use cases for a sitemap: one is the XML sitemap used by Google, and the other one is a proper HTML page where users can get a glimpse of the site as a whole. They serve 2 quite different purposes and even if they overlap, I would expect to find both in a web site. Thanks for the suggestion of downgrading, I'll probably do that.

If it's not too much to ask here, can you confirm that in v. 2. the XML map includes all pages, and it's only its HTML representation that filters the pages by languages?

The 'sitemap' object contains all the languages now, where before it only contained the 'active' language. That's why you saw Italian sitemap for /it/sitemap and English for /en/sitemap. Also this was only an HTML representation of the XML via an XSL stylesheet.

I've just pushed a commit that will be part of 3.0.1 (a69208a) that allows you to enabled html_support for the plugin, and when you do that, you can then view a proper and configurable HTML version of the sitemap that is rendered by sitemap.html.twig.

This will only show the current active language so it functions like prior versions. I think this is exactly what you are looking for while still supporting the 'proper' XML version for search engines.

CleanShot 2021-02-08 at 15 19 22@2x

BTW, here's a screenshot using the "grav-skeleton-multilang" sample site.

Thanks again for your help. Sorry to comment on a closed issue, but I don't know if it's worth opening another thread...

I've noticed that in v. 3.0 many pages are listed separately even though they belong to the same Grav page. See "politica-cookies", for instance (https://qabiria.com/politica-cookie): I have a single folder named "politica-cookie" with 3 files inside, default.en.md, default.it.md, default.es.md, where EN and ES are translations of the Italian file. They have a different slug, because - following best practices - I have translated all URLs.

I would expect 3 different <url> elements in the sitemap, with cross-referenced rel="alternate" entries, but, instead, I do have 3 different <url> but there is no relation between each other.

Is this an issue with the sitemap plugin or with Grav multilingual features?

I would open a new issue about this as clearly the urls should be related. The issue is likely in the sitemap plugin as it outputs the sitemap.