Last active
February 24, 2018 10:46
-
-
Save KittyGiraudel/9755b37f7ec005f7e7a7 to your computer and use it in GitHub Desktop.
Here is an easy way to handle i18n in a Jekyll website.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _data/en.yml | |
header: | |
title: "Hello world!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index.html --> | |
--- | |
lang: fr | |
--- | |
{% include header.html %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _data/fr.yml | |
header: | |
title: "Bonjour le monde!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- _includes/header.html --> | |
<h1>{{ site.data[page.lang].header.title }}</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- index.html --> | |
--- | |
lang: en | |
--- | |
{% include header.html %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment