So, I’m blogging in 2 languages. It’s not specifically a multi-language site. I made an internal tag for the language at every post.
Is it even possible to override the <html lang="">
based on the internal tag at post.hbs?
It’s like, if the post has an internal tag of “EN”, change the default locale of <html lang="{{@site.locale}}">
to <html lang="EN">
Here is an example of how I can do it.
<HTML lang='{{{ block 'language' }}}'>
Then, all template files like tag.hbs
, and author.hbs
.
{{#contentFor 'language'}}{{ @site.locale }}{{/contentFor}}
And in the post.hbs
file.
{{#contentFor 'language'}}{{#has tag='#EN'}}EN{{else}}{{ @site.locale }}{{/has}}{{/contentFor}}
Make sure the above line is inside the {{#post}} {{/post}}
helper.
I used the block
and has
helpers, which you can learn more about.
2 Likes
Yep, that’s what I need. Thank you
1 Like