minimal-mistakes
minimal-mistakes copied to clipboard
Using locale & language tags from page instead of site
This is an enhancement or feature.
Summary
By using the locale tag from the page, it allows different language pages on the same site.
Context
Previously it only allows a site to have only one language, which limits the ability to create multi-lingo sites.
With this proposed change, the pages are rendered using the locale tag from the page front matter, so that you can create pages for different languages on your website.
I have my website running with this change.
For example this page: https://vrstormlab.com/dancexr/ Click on one of the language links below the title and you'll land on a new page with the same content but for a different language. The locale and lang tags are set correctly for each page so that the browser can recognize.
I don't think page.locale propagates from site.locale. This means existing users who don't have proper page.locale will suddenly find their site back in English. If the fallback to site.locale is taken care of, I'll be OK with this PR.
Here's my new idea: Since all templates end up being rendered in default.html, we can assign our desired variables in default.html and use it everywhere. Something like:
<!-- _layouts/default.html -->
{% assign locale = page.locale | default: site.locale %}
<!-- everywhere else -->
{{ site.data.ui-text[locale].blahblahblah }}
If you'd like to proceed, consider taking this approach or we can discuss another idea that you find better.