Closed bingen13 closed 6 years ago
Hi David. Is this something you would like to help implement?
isn't that a theming problem? it should check if there is article language set and fallback to the global setting.. i think i have seen this approach in a number of themes already.
On 3 October 2017 at 18:11, Justin Mayer notifications@github.com wrote:
Hi David. Is this something you would like to help implement?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/getpelican/pelican/issues/2212#issuecomment-333892228, or mute the thread https://github.com/notifications/unsubscribe-auth/AEOv-rYZptGFNWvA09qZ-5NKrIHgY2NCks5solyagaJpZM4PaGhv .
Manage it in the pelican code would avoid problem with theme that don't manage it correctly.
How can pelican manage this? All the meta fields in the final HTML output is handled by the theme. Pelican only supplies the content as HTML.
Here is the solution:
base.html
of the theme:<html lang="{% block html_lang %}{{ DEFAULT_LANG }}{% endblock %}">
article.html
:{% block html_lang %}{{ article.lang }}{% endblock %}
page.html
:
{% block html_lang %}{{ page.lang }}{% endblock%}
@Postroutine, I think that changing three lines of code is not very difficult. You can submit a pull request to the theme you are using or just change it to fit your needs. With that said, I would vote to close this issue.
Is there any value in adding @jorgesumle's suggested changes to the default theme's base.html, article.html, and page.html?
The lang attribute is set globally for the entire blog, taken from the DEFAULT_LANG setting. However, posts and pages may be written in different languages, which are indicated on their metadata through the Lang field. This should change the language for those posts when shown together, and for the post URL when shown alone.