Try to add tags

http://www.minddust.com/post/tags-and-categories-on-github-pages/ except
step 6 that I don't understand.
This commit is contained in:
Aminda Suomalainen 2015-01-24 14:44:00 +02:00
parent a9076623bc
commit 1a0bc9b25d
7 changed files with 38 additions and 4 deletions

6
_data/tags.yml Normal file
View File

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

11
_layouts/blog_by_tag.html Normal file
View File

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

View File

@ -1,6 +1,22 @@
---
layout: default
---
{% if post.tags.size > 0 %}
{% 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 %}
{% for post_tag in post.tags %}
{% for data_tag in site.data.tags %}
{% if data_tag.slug == post_tag %}
{% assign tag = data_tag %}
{% endif %}
{% endfor %}
{% if tag %}
{% capture tags_content_temp %}{{ tags_content }}<a href="/blog/tag/{{ tag.slug }}/">{{ tag.name }}</a>{% if forloop.last == false %}, {% endif %}{% endcapture %}
{% assign tags_content = tags_content_temp %}
{% endif %}
{% endfor %}
{% else %}
{% assign tags_content = '' %}
{% endif %}
<div class="post">
<header class="post-header">
@ -10,6 +26,7 @@ layout: default
<article class="post-content">
{{ content }}
<p id="post-meta">{{ tags_content }}</p>
</article>
</div>

View File

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

View File

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

View File

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

View File

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