Closed escapedcat closed 8 years ago
You can do this exactly the way you want except that you have to check if the language is equal to the currently rendered language.
{% for page2 in site.pages %}
{% if page2.language == page.language %}
{% if page2.subset %}
{% assign page2_title_key = page2.subset | append: '.title' %}
<a href="{{ site.baseurl }}{{ page2.url }}">{% t page2_title_key %}</a>
{% endif %}
{% endif %}
{% endfor %}
I have changed the local page
variable into page2
to retain access to the currently rendered page
. Also, we are using the title from the page subset.
I have improved the example site and included the above snippet with an option to disable the navigation entry for a given page.
That helped me a lot. Thanks for your support! :relaxed:
How could I get a list of pages and use the translated title form the subset?
Here the idea form the Jekyll example page: https://github.com/jekyll/example/blob/gh-pages/_includes/header.html#L15-L21
Basically I would like to create some sort of navigation. I'm not sure how to achieve something like this. Looks like I can't get the title through this:
Also my non existent ruby skills don't help...