Skip to content

Latest commit

 

History

History
77 lines (68 loc) · 2.05 KB

traductions_categories.md

File metadata and controls

77 lines (68 loc) · 2.05 KB
layout title permalink
page
Traductions par catégories
/traductions_categories/

{% comment %}

Trouvé sur https://codinfox.github.io/dev/2015/03/06/use-tags-and-categories-in-your-jekyll-based-github-pages/ The following part extracts all the tags from your posts and sort tags, so that you do not need to manually collect your tags to a place.

{% endcomment %} {% assign rawtags = "" %} {% for post in site.posts %} {% assign ctags = post.tags | join:'|' | append:'|' %} {% assign rawtags = rawtags | append:ctags %} {% endfor %} {% assign rawtags = rawtags | split:'|' | sort %}

{% comment %}

The following part removes dulpicated tags and invalid tags like blank tag.

{% endcomment %} {% assign tags = "" %} {% for tag in rawtags %} {% if tag != "" %} {% if tags == "" %} {% assign tags = tag | split:'|' %} {% endif %} {% unless tags contains tag %} {% assign tags = tags | join:'|' | append:'|' | append:tag | split:'|' %} {% endunless %} {% endif %} {% endfor %}

Catégories

{% comment %}

The purpose of this snippet is to list all the tags you have in your site.

{% endcomment %}

{% for tag in tags %} {{ tag }}   {% endfor %}

 


{% comment %}

The purpose of this snippet is to list all your posts posted with a certain tag.

{% endcomment %}

{% for tag in tags %}  

{{ tag }}   ⤴︎

    {% for post in site.posts %} {% if post.tags contains tag %}
  • {% endif %} {% endfor %}
{% endfor %}