getgrav / grav-plugin-sitemap

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

No multi-language support? #42

Closed Crolug closed 3 years ago

Crolug commented 7 years ago

Did I do something wrong or the plugin doesn't recognize additional languages?

flaviocopes commented 7 years ago

@Crolug can you provide more info on how to replicate your problem? Works for me

ktaranov commented 7 years ago

Hi, @flaviocopes . Same problem, example: http://sqlserver-kit.org/sitemap Latest version of plugin: 1.9.1

jimblue commented 7 years ago

Same problem here, multi-language is not supported.

http://wplang.org/sitemaps-multiple-languages-wordpress/

Crolug commented 7 years ago

Yes, thank you @jimblue , this article sums it up nicely how the multi-language sitemap should look like. That's what I meant - this plugin doesn't work that way afaik.

rhukster commented 7 years ago

No one interested in trying to create a pull request to implement the multi-language sitemap format?

jimblue commented 7 years ago

Sorry @rhukster I have no idea how to do that 😞 I'm not really a dev

jimblue commented 7 years ago

@rhukster, I'm trying to understand the code... maybe it just miss something like foreach language before this?

https://github.com/getgrav/grav-plugin-sitemap/blob/756479720d19148834f3a59cbbae67e828180d6b/sitemap.php#L68

rhukster commented 7 years ago

This does require some thinking and a better solution. I've not got time to look into it now, but if someone can help, that would be appreciated.

jimblue commented 6 years ago

Any update about this?

humhann commented 6 years ago

There luckily already is multilanguage support (since April 2017, version 1.9.1).

What crawlers see is sitemap.xml:

sitemap-xml

Note how for each link, their counterparts in other languages are provided.

What we see when opening /sitemap in browser is styled by sitemap.xsl, where some parameters are hidden:

sitemap-xsl

So all information needed for efficient multilanguage sitemap is already there for Google and other crawlers to see, but is hidden when viewing with styles in browser.

humhann commented 6 years ago

If styling in sitemap.xsl should be changed so that it is more apparent that multilanguage support is implemented is another question. It might make sense to avoid confusions like these?

fabbow commented 6 years ago

I agree that the styling should be changed or removed rather. What's missing in the implementation of the hreflang though is an x-default and the route of the URL instead of the raw route if someone uses a translated alias for the URL. I just started using Grav and am absolutely not sure how to do this, but I'll try digging into this.

fabbow commented 6 years ago

Okay, so apparently there's no clean way of doing this (or I have yet to find it). What I do now is to CURL through the raw route URLs and use the redirects final destination for the sitemap. This is obviously very bad, but I prefer a clean sitemap to clean code... Could anyone give me a hint on how to cache the sitemap properly?

01Kuzma commented 3 years ago

No any updates?

rhukster commented 3 years ago

The current PR #83 is pretty beefy and needs to be thoroughly tested before we will able to merge and release a new version. I suggest checking out this PR and testing it for yourself and letting us know how it works.

01Kuzma commented 3 years ago

I've downloaded two files from PR #83 and replaced originals and the result is negative. Tested on Grav 1.7 RC17 Now a URL http://localhost/project/LANG_CODE/sitemap loads and shows some data (before it there was no any links), but rendered links are without the language code inside. They are pointing to the same default's language data.

rhukster commented 3 years ago

Multilang support has been rewritten and significantly improved. Please try v3.0