Fix #2 List of tags

This commit is contained in:
Alexis Hassler
2019-05-04 21:52:13 +02:00
parent 6773809206
commit 8d635a3f71
12 changed files with 101 additions and 49 deletions

View File

@@ -0,0 +1,33 @@
{%- comment -%}
=======================
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 = "" -%}
{%- include /functions/wiki-pages.html -%}
{%- for wiki_page in wiki_pages -%}
{%- assign ttags = wiki_page.tags | join:'|' | append:'|' -%}
{%- assign rawtags = rawtags | append:ttags -%}
{%- 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 -%}
{%- assign wiki_tags = tags -%}