07 Jul 2025
Jekyll-Polyglot 1.10 ya está disponible. Presenta grandes mejoras y cambios en el plugin liquid i18n_headers
para SEO, y pequeños ajustes para la idempotencia en compilaciones paralelas. Las contribuciones de la comunidad y Vibe Coding ayudaron en gran parte de las características, pruebas y redacción de esta versión.
El plugin i18n_headers
ahora tiene capacidades extendidas en esta versión:
- Añade
<link rel="canonical" ...>
para cada idioma de la página, asegurando que el indexado sea único en todos los sitios.
- Añade
<link rel="alternate" hreflang="x-default" ...>
para apuntar a la versión en el idioma predeterminado cuando el navegador no solicita un idioma específico.
- Define correctamente
<link rel="alternate" hreflang="...">
para páginas y posts en colecciones con permalinks personalizados.
- La URL predeterminada ahora incluirá
site.baseUrl
si está definido.
Esto también corrige un error que causaba que la relativización de URLs absolutas alterara estas etiquetas involuntariamente.
Contribuciones vibe-coded
El uso de ciertas herramientas de vibe coding ayudó a encontrar, medir y verificar correcciones y características para este lanzamiento. Es un enfoque nuevo para el desarrollo de software, y permitió crear avanzadas pruebas en Ruby para código de plugins de Jekyll ejecutándose en muchos idiomas del sitio construido.
Las pruebas escritas con vibe coding ayudaron a mantener una alta cobertura de pruebas y a añadir características complejas con confianza. Garantizar la automatización de pruebas permitió construir correctamente características complicadas.
Además, las herramientas de vibe coding ayudaron a traducir esta entrada de blog a muchos idiomas.
Contribuciones de la comunidad
Jekyll-Polyglot ha sido apoyado por personas. La documentación en lenguas humanas es aportada por personas que desean ver este plugin documentado en su lengua materna. Las personas que contribuyen con correcciones y documentación han ayudado a que este plugin alcance miles de descargas por versión. La programación asistida por IA, en mis manos o en las tuyas, dará forma al software que usamos y a los muchos idiomas en los que escribimos y hablamos.
ruby >= 3.1 requerido
Las actualizaciones de seguridad continuas de las dependencias de compilación de jekyll-polyglot requirieron una actualización importante a ruby 3.1. Esto puede afectar a los sistemas de compilación que generan su documentación con jekyll-polyglot. Ahora es un buen momento para actualizar a la última versión principal de ruby. Avísanos si estos cambios causan complicaciones con las compilaciones de jekyll.
18 Jan 2025
Jekyll-Polyglot 1.9.0 has been released, which has minor dependency updates, and instructional improvements for getting the most from your multi-language website.
Thank you to aturret for helping to maintain the existing zh-CN
site pages. 谢谢!
george-gca improved the optional derive_lang_from_path
configuration to better identify document language from the path inference. Tests were added for his helpful feature improvement PR. This improvement helps infer the language of posts and pages missing lang
frontmatter, from any part of the document filepath.
Github user yunseo-kim submitted a instructions to improve sitemap generation . To help with SEO, a website should have only one root sitemap.xml , and not have duplicates for each sub-language site. Be sure to add the sitemap.xml
to the exclude_from_localization
configuration.
18 Aug 2024
Se ha lanzado Jekyll-Polyglot 1.8.1, que presenta algunas mejoras en las funciones y reconoce errores encontrados por la comunidad y proporciona correcciones.
Correcciones proporcionadas por la comunidad
hacketiwack proporcionó una verificación más estricta para establecer un enlace permanente del documento, evitando problemas posteriores con campos de frontmatter vacíos.
El usuario de Github blackpill envió una corrección de error de un carácter para la etiqueta de encabezados i18n al renderizar la alternativa href del enlace del idioma predeterminado.
17 Mar 2024
Get excited for Jekyll-Polyglot 1.8.0, which has a few feature improvements and recognizes community documentation and contributions!
language specific permalinks
One new feature is to give pages language specific permalinks and to retain their association to other relative pages. This new feature is again improved by antoniovazquezblanco, who is a gentleman and a scholar.
sitemap generation & i18n SEO
This release also recognizes the quality sitemap.xml and robots.txt solution provided by jerturowetz. This website now demonstrates and captures more SEO power by using these to be crawlable as a static jekyll website by search providers. See the example website files here.
jekyll :polyglot :post_write hook
Github user obfusk contributed a tiny PR a few years back:
With polyglot :site, :post_write
like these run for each child processes:
Jekyll::Hooks.register :site, :post_write do |site|
...
end
This release adds a custom :post_write
hook that runs exactly once, after all languages been processed (whether or not parallel_localization
is used):
Jekyll::Hooks.register :polyglot, :post_write do |site|
# do something amazing here!
end
This feature is helpful for complex jekyll static sites that make additional use of jekyll hook plugins.
She also contributed a fix for additional logging when language subprocesses crash. Thanks for this contribution!
localized variables and portuguese translation.
george-gca is a talented and awesome guy, contributing an entire blogpost on how best to localize rich text from site data. He also provided a site brazilian translation.
29 Feb 2024
Polyglot allows you to have different pages for different languages in your Jekyll site. For example, one could have a page about.md
in English and another about.md
in Spanish with completely different layouts. But if you want to have the same layout for both pages, you can use localized variables. This is a way to have different data for different languages in your Jekyll site, but using the same layout for all languages.
As an example I will use a template site created with Polyglot.
Sharing a layout between pages
In that site they have an about page for every language, in their case english in _pages/en-us/about.md and brazilian portuguese in _pages/pt-br/about.md. In both pages we can see that they have the same keys in the frontmatter, but some with different values. Both files point to the same layout, about, and this layout uses the values in the frontmatter to render the page.
For example, the subtitle
key in the english page has the value subtitle: <a href='#'>Affiliations</a>. Address. Contacts. Moto. Etc.
and in the brazilian portuguese page it has subtitle: <a href='#'>Afiliações</a>. Endereço. Contatos. Lema. Etc.
. To use this information in the layout, it is used like this:
The same goes for the content below the frontmatter in both files, which is simply used in the layout like this:
Polyglot will automatically render the page with the correct values for the current language.
Sharing a layout between pages with localized data
For the subtitle
of the page they used key: value
pairs in the frontmatter, but sometimes we want to use these same pairs in different parts of the site. For example, if we want to use the same subtitle
in the about.md
and in another page, we would have to repeat the same pair in the frontmatter of both pages. This is not ideal because if we want to change the subtitle
we would have to change it in two places. This is where localized data comes in. You can create a file like _data/:lang/strings.yml
, one for each language, and Polyglot will bring those keys under site.data[:lang].strings
.
For example, in the template site there are two files, _data/en-us/strings.yml and _data/pt-br/strings.yml. In the first file they have:
latest_posts: latest posts
And in the second file they have:
latest_posts: últimas postagens
This way, they can use the latest_posts
key in the layout like this:
{{ site.data[site.active_lang].strings.latest_posts }}
Which will correctly get the value for the latest_posts
variable defined in the file _data/:lang/strings.yml
for the current language.
Defining which variable to use in the frontmatter
Now if you want to define this variable in the frontmatter of the page, this gets a little bit trickier. One possible solution is to check if the value of the variable has a .
in it, and if it does use the value in the file _data/:lang/strings.yml
. This is how you would do it:
{% if frontmatter_var contains '.' %}
{% assign first_part = frontmatter_var | split: '.' | first %}
{% assign last_part = frontmatter_var | split: '.' | last %}
{% capture result %}{{ site.data[site.active_lang].strings[first_part][last_part] }}{% endcapture %}
{% endif %}
{{ result }}
This will work, for example, if frontmatter_var = blog.title
.
Now, if you need to check if the localization string (in this case blog.title
) actually exists in the file _data/:lang/strings.yml
before using it, you’ll have to create a plugin to check if the variable exists in the file _data/:lang/strings.yml
and if it does, use it, otherwise fallback to any value you want. I will not go into detail on how to do this, but I will show you how to use it. You can see the code for the plugin here.
{% if frontmatter_var contains '.' %}
{% capture contains_localization %}{% localization_exists {{ frontmatter_var }} %}{% endcapture %}
{% if contains_localization == 'true' %}
{% assign first_part = frontmatter_var | split: '.' | first %}
{% assign last_part = frontmatter_var | split: '.' | last %}
{% capture result %}{{ site.data[site.active_lang].strings[first_part][last_part] }}{% endcapture %}
{% else %}
{% capture result %}fallback value{% endcapture %}
{% endif %}
{% endif %}
{{ result }}