jekyll-theme-hpstr
jekyll-theme-hpstr copied to clipboard
Multilingual support
First of all, thanks for such a great theme! Is it possible to add localization support?
Sure. I probably won't have the time to do it since I'm not actively adding new features for this theme. But if you wanted to submit a PR I'd look at it.
I've tackled this in my other themes so I'd be looking for something similar if I was to merge it in.
Anything beyond localizing simple text strings pushes things into plugin territory and I'd like to avoid that since it's best left for the user to decide if they want to add it.
Hi, If you want, I already implement a kind of multilingual feature on my own blog. My blog is still in French, but I add the ability of adding post in English.
-
First, I've created a
langattribute on my post's mardown files.layout: post title: my title description: "en" tags: ["a", "b", "c"] lang: en image: -
Then, when I loop on articles, I check if lang is defined to put a flag.
Look: (template file){% for post in site.posts %} //... {% if post.lang == "en" %} <li class="entry-title"> <a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}"><img src="{{ site.url }}/images/uk-flag.png" alt="english article"> {{ post.title }}</a> </li> {% else %} <li class="entry-title"> <a href="{{ site.url }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> </li> {% endif %} //... {% endfor %}
Here's the result: http://maxpou.fr (look line: "Vagrant, Symfony and Windows are not incompatibles")