-
-
Notifications
You must be signed in to change notification settings - Fork 21
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_locales option #25
Conversation
This makes sense, thanks for the pull request! I'm going to try to test this out and merge this week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! I'm tempted to change the README example as it seems having the primary language mixed in with the alternatives is "best practice" and I wouldn't want persuade against that: https://en.wikipedia.org/wiki/Sitemaps#Multilingual_and_multinational_Sitemaps
I might use the example of having incomplete translations that you don't want to publish yet instead, as I've run into that with another project that supports translations and we wouldn't actually "turn them on" until they hit a certain percentage of completion. In the end, I think the example you provided works, so don't worry about changing that part.
To a multilingual sitemaps: I really dislike this style - primary language in, all languages in xhtml:link including primary, and repeat and xhtml:link for all languages. But it looks it's official way how to describe multilingual website. Do I understand it correctly that if I have three pages -
|
I agree, but I can only assume it is for making the sitemap easier to digest by machines. On this page, under Methods for indicating your alternate pages, it gives a sitemap example (as a dropdown) and states as the first guideline:
|
Thanks again for this addition! |
I propose to add the
sitemap_locales
configuration option to manually set locales that will show in the sitemap as alternates to page.I've started to use sphinx-sitemap for my blog at https://blog.documatt.com. It's a single language and likely will stay. It's Sphinx with Ablog extension for blogging. It's a great extension that comes with many supported locales like Chinese, Korean, Spain, etc.
Unfortunately, it means that if another extension like sphinx-sitemap asks for
app.builder.config.locale_dirs
, the result is a long list of locale_dirs. Formerget_locales()
will then result in the same long list of locales. But they come from third-party extension!So I add the
sitemap_locales
option to manually override locales which I need/want to list in sitemaps. By default, nothing changed (autodetection will take place).But I can limit alternate URLs (e.g.
sitemap_locales = ['es', 'fr']
) or completely turn them off (sitemap_locales = [None]
)