Browse Source

Try to add tags

http://www.minddust.com/post/tags-and-categories-on-github-pages/ except
step 6 that I don't understand.
tags/2016-05-10
Mikaela Suomalainen 4 years ago
parent
commit
1a0bc9b25d

+ 6
- 0
_data/tags.yml View File

@@ -0,0 +1,6 @@
1
+- slug: finnish
2
+  name: in Finnish
3
+- slug: english
4
+  name: in English
5
+- slug: irc
6
+  name: IRC

+ 11
- 0
_layouts/blog_by_tag.html View File

@@ -0,0 +1,11 @@
1
+<h1>Articles by tag :{{ page.tag }}</h1>
2
+<div>
3
+    {% if site.tags[page.tag] %}
4
+        {% for post in site.tags[page.tag] %}
5
+            <a href="{{ post.url }}/">{{ post.title }}</a>
6
+        {% endfor %}
7
+    {% else %}
8
+        <p>There are no posts for this tag.</p>
9
+    {% endif %}
10
+</div>
11
+

+ 17
- 0
_layouts/post.html View File

@@ -1,6 +1,22 @@
1 1
 ---
2 2
 layout: default
3 3
 ---
4
+{% if post.tags.size > 0 %}
5
+    {% capture tags_content %}Posted with {% if post.tags.size == 1 %}<i class="fa fa-tag"></i>{% else %}<i class="fa fa-tags"></i>{% endif %}: {% endcapture %}
6
+    {% for post_tag in post.tags %}
7
+        {% for data_tag in site.data.tags %}
8
+            {% if data_tag.slug == post_tag %}
9
+                {% assign tag = data_tag %}
10
+            {% endif %}
11
+        {% endfor %}
12
+        {% if tag %}
13
+            {% capture tags_content_temp %}{{ tags_content }}<a href="/blog/tag/{{ tag.slug }}/">{{ tag.name }}</a>{% if forloop.last == false %}, {% endif %}{% endcapture %}
14
+            {% assign tags_content = tags_content_temp %}
15
+        {% endif %}
16
+    {% endfor %}
17
+{% else %}
18
+    {% assign tags_content = '' %}
19
+{% endif %}
4 20
 <div class="post">
5 21
 
6 22
   <header class="post-header">
@@ -10,6 +26,7 @@ layout: default
10 26
 
11 27
   <article class="post-content">
12 28
     {{ content }}
29
+    <p id="post-meta">{{ tags_content }}</p>
13 30
   </article>
14 31
 
15 32
 </div>

+ 1
- 1
_posts/2014-12-30-test.md View File

@@ -2,7 +2,7 @@
2 2
 layout: post
3 3
 title: Testing...
4 4
 category: [english]
5
-tags: [test, english]
5
+tags: [english]
6 6
 ---
7 7
 
8 8
 It seems that I started trying the blog feature of Jekyll too.

+ 1
- 1
_posts/2014-12-30-testi.md View File

@@ -2,7 +2,7 @@
2 2
 layout: post
3 3
 title: Kokeilua...
4 4
 category: [finnish]
5
-tags: [testi, finnish]
5
+tags: [finnish]
6 6
 ---
7 7
 
8 8
 Vaikuttaa siltä, että aloitin myös Jekyllin bloggaustoiminnon kokeilun.

+ 1
- 1
_posts/2015-01-10-channels-hostmask-groups-a-basic-howto.md View File

@@ -2,7 +2,7 @@
2 2
 layout: post
3 3
 title: "Channels & Hostmask groups: A basic Howto"
4 4
 category: [english]
5
-tags: [oper, irc, groupserv, hostserv]
5
+tags: [irc, english]
6 6
 ---
7 7
 
8 8
 @Annwenn got me opering at her network after long pause with my opering.

+ 1
- 1
_posts/2015-01-24-getting_help_with_channel_issues.md View File

@@ -2,7 +2,7 @@
2 2
 layout: post
3 3
 title: "Getting help from network operators with channel issues when ops are away"
4 4
 category: [english]
5
-tags: [oper, irc, groupserv, hostserv]
5
+tags: [irc, english]
6 6
 ---
7 7
 
8 8
 In case you wish network operators to help you when your channel operators

Loading…
Cancel
Save