jekyll-theme-chirpy
jekyll-theme-chirpy copied to clipboard
feat(i18n): allow `page.lang` to override `site.lang`
Type of change
- [x] New feature (non-breaking change which adds functionality)
Description
Allow lang
on page/post to override site.lang
.
This is useful to create folders (collections) of different languages. For example, I have folders _en
, _ru
and _tr
(relative urls en
, ru
and tr
), and then define these as collections in _config.xml
:
collections:
en:
output: true
ru:
output: true
tr:
output: true
defaults:
- scope:
path: ""
type: en
values:
lang: en
- scope:
path: ""
type: tr
values:
lang: tr-TR
- scope:
path: ""
type: ru
values:
lang: ru-RU
It's also possible to just put lang: ru-RU
directly into the page front matter.
Additional context
I removed usage of site.alt_lang
in the html lang
tag of default
layout because I'm not sure what that was for. If there's a reason for it then I could put it back.
I don't exactly know what js-selector.html
is doing with lang
, so I couldn't test it, but the change seems obvious.