Skip to content
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 hreflang syntax invalid for regional language variants fix #5638

Merged
merged 3 commits into from
May 13, 2019

Conversation

saadmk11
Copy link
Member

closes #5446

@humitos humitos requested a review from a team May 9, 2019 11:23
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to figure out another approach to this problem since we can't change the LANGUAGES constant because it's used for URLs and Sphinx as well as language form validation.

('es-MX', 'Mexican Spanish'),
('uk-UA', 'Ukrainian'),
('zh-CN', 'Simplified Chinese'),
('zh-TW', 'Traditional Chinese'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can change this.

LANGUAGES is used for URLs, and by changing this constant we will be breaking many URLs. Also, these constant matches the language= setting from Sphinx.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@humitos we can add a method to sitemap_xml view to change the lang if its not in the correct format. somthing like if lang == 'zh_CN': return 'zh-CN'. It would be a hacky process though. What do you think we can do here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds hacky, but good enough to me considering that it's what we need and it's encapsulated inside the sitemap_xml.

Is the only thing that needs to be replaced _ by -? Did you check the sitemap reference?

What about the rest of the values? are they valid?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@humitos yes, we only need to replaced _ by - . Updated the PR please have a look.

@humitos
Copy link
Member

humitos commented May 13, 2019

Thanks!

@humitos humitos merged commit e0ea4a5 into readthedocs:master May 13, 2019
@saadmk11 saadmk11 deleted the sitemap-hreflang-syntax-fix branch May 13, 2019 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sitemap hreflang syntax invalid for regional language variants
2 participants