untra/polyglot

Does not localise other collections than the "posts" collection.

Closed this issue · 2 comments

Documents in _posts will be recognised by polyglot and copied to the _site directory into their corresponding language directories as expected:

  • _posts/2016-11-07-welcome-to-jekyll.en.markdown_site/posts/welcome-to-jekyll/index.html with contents of 2016-11-07-welcome-to-jekyll.en.markdown
  • _posts/2016-11-07-welcome-to-jekyll.de.markdown_site/de/posts/welcome-to-jekyll/index.html with contents of 2016-11-07-welcome-to-jekyll.de.markdown

For other collections, only the standard language version of the document will be processed. The site.active_lang variable is correctly set to the active language so references to it will be substituted correctly. All links will point to the standard language version of documents.

  • _apps/01-app1.en.md:
---
title: App1 (en)
permalink: /apps/app1/
lang: en
---
App1 (en ↔ {{site.active_lang}})
[app1](/apps/app1/)
  • _apps/01-app1.de.md:
---
title: App1 (de)
permalink: /apps/app1/
lang: de
---
App1 (de ↔ {{site.active_lang}})
  • _config.yml:
…
collections:
    posts:
        output: true
        permalink: "/:collection/:title/"
    apps:
        output: true
…

will result in

  • _site/apps/app1/index.html with contents of 01-app1.en.md, displaying en → en and a link pointing to the English version.
  • _site/de/apps/app1/index.html with contents of 01-app1.en.md, displaying en → de and a link pointing to the English version.

The following Liquid code used with the corresponding indexes of the collections posts and apps will reveal that it contains only the documents for the active language in case of a posts document. It will contain the documents of all languages for the apps collection, though.

<ul>
{% for doc in site.collections[ 1 ].docs %}
    <li>{{ doc.path }}</li>
{% endfor %}
</ul>

Is the localisation of documents restricted to pages and the posts collection? It seems as if documents with similar names and same permalinks in collections other than the posts collection are not recognised so that the localisations are treated as intended. Or maybe I have overlooked some crucial details in my setup.

untra commented

I like this feature idea. Different collections are a newer Jekyll feature that Polyglot wasn't originally designed around, but should definitely provide implementation support. 👍

vlsi commented

@PierreBongen , can you please check if #45 solves the issue for you?