getgrav / grav-plugin-sitemap

Grav Sitemap Plugin
https://getgrav.org
MIT License
42 stars 42 forks source link

Does this plugin works for multi language grav sites? #25

Closed ktaranov closed 7 years ago

ktaranov commented 7 years ago

Hy, guys.

Thanks for plugin, Does this plugin works for multi language sites? For example, for my site plugin generate only english pages: http://sqlserver-kit.org/sitemap

royalrex commented 7 years ago

As far as I can tell it will only generate sitemap based on any language setting received by the client through preferred language setting or url based /en /fr /de etc.

I would really like to see the change be made so that the root would be default language with alternate content locations for translated content to form sections like this:

<url>
    <loc>https://www.domain.com/what-we-do</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.domain.com/what-we-do" />
    <xhtml:link rel="alternate" hreflang="en" href="https://www.domain.com/en/what-we-do" />
    <xhtml:link rel="alternate" hreflang="it" href="https://www.domain.com/it/what-we-do" />
</url>

per https://support.google.com/webmasters/answer/189077?hl=en

It appears that it needs a lot of cross linking, look at this example: https://support.google.com/webmasters/answer/2620865?hl=en

So a correct full sitemap from the previous code example should be:

<url>
    <loc>https://www.domain.com/what-we-do</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.domain.com/what-we-do" />
    <xhtml:link rel="alternate" hreflang="en" href="https://www.domain.com/en/what-we-do" />
    <xhtml:link rel="alternate" hreflang="it" href="https://www.domain.com/it/what-we-do" />
</url>
<url>
    <loc>https://www.domain.com/en/what-we-do</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.domain.com/what-we-do" />
    <xhtml:link rel="alternate" hreflang="en" href="https://www.domain.com/en/what-we-do" />
    <xhtml:link rel="alternate" hreflang="it" href="https://www.domain.com/it/what-we-do" />
</url>
<url>
    <loc>https://www.domain.com/it/what-we-do</loc>
    <xhtml:link rel="alternate" hreflang="x-default" href="https://www.domain.com/what-we-do" />
    <xhtml:link rel="alternate" hreflang="en" href="https://www.domain.com/en/what-we-do" />
    <xhtml:link rel="alternate" hreflang="it" href="https://www.domain.com/it/what-we-do" />
</url>

In other words, it should output a URL section for each and every path including language versions and cross refer the language version from each section to group them together.

ossplus commented 7 years ago

the latest version still have this issue.

flaviocopes commented 7 years ago

PR https://github.com/getgrav/grav-plugin-sitemap/pull/36 introduces support for multilanguage.

Feedback welcome!

ossplus commented 7 years ago

I used this module for a client website , sitemap https://www.bsdlab.com/sitemap It works well. This issue should be closed now.

ghost commented 7 years ago

@flaviocopes - we're waiting for this feature. Do you have plans to include it in some future release?