diff --git a/assets/css/mystyle.css b/assets/css/mystyle.css index 3e9375d..ed69cbd 100644 --- a/assets/css/mystyle.css +++ b/assets/css/mystyle.css @@ -52,3 +52,14 @@ pre, code{ .svg-icon { vertical-align: text-bottom; } + +/* tags page */ +.tagnames { + margin-bottom: 16px; + margin-left: 16px; +} +.tags-title {} +.tags hr { + color: rgba(200, 200, 200, 0.5); + margin-bottom: 16px; +} diff --git a/tags.html b/tags.html index 24553ac..6e1e38e 100644 --- a/tags.html +++ b/tags.html @@ -3,4 +3,82 @@ layout: default title: Tags --- -This is the tags page :) + + +{% 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 = "" %} +{% for post in site.articles %} + {% assign ttags = post.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 %} + + + +{% comment %} +======================= +The purpose of this snippet is to list all the tags you have in your site. +======================= +{% endcomment %} +
+ + +{% comment %} +======================= +The purpose of this snippet is to list all your posts posted with a certain tag. +======================= +{% endcomment %} +{% for tag in tags %} + {% assign slug_tag = tag | slugify %} +