Skip to content
Browse files

add tags support

  • Loading branch information...
1 parent a76a255 commit 6b5a3ec58d0e08cf656c8769f5ee9784f897749b @imkerberos committed Mar 26, 2012
Showing with 52 additions and 4 deletions.
  1. +6 −0 _config.yml
  2. +3 −2 _includes/custom/navigation.html
  3. +2 −1 _includes/post/date.html
  4. +20 −0 _includes/post/tags.html
  5. +5 −1 _layouts/post.html
  6. +16 −0 tags.html
View
6 _config.yml
@@ -21,6 +21,12 @@ subscribe_rss: /atom.xml
subscribe_email:
# RSS feeds can list your email address if you like
email: Kerberos Zhang <kerberos.zhang@gmail.com>
+# ----------------------- #
+# Site path
+# ----------------------- #
+archives_path: /archives.html
+tags_path: /tags.html
+about_path: /about.html
# ----------------------- #
# Jekyll & Plugins #
View
5 _includes/custom/navigation.html
@@ -1,5 +1,6 @@
<ul class="main-navigation">
<li><a href="{{ root_url }}/">Blog</a></li>
- <li><a href="{{ root_url }}/archives.html">Archives</a></li>
- <li><a href="{{ root_url }}/about.html">About</a></li>
+ <li><a href="{{ root_url }}{{ site.archives_path }}">Archives</a></li>
+ <li><a href="{{ root_url }}{{ site.tags_path }}">Tags</a></li>
+ <li><a href="{{ root_url }}{{ site.about_path }}">About</a></li>
</ul>
View
3 _includes/post/date.html
@@ -2,6 +2,8 @@
{% capture kdate %}{{ date | date: site.date_format }}{% endcapture %}
{% comment %}
{% capture date_formatted %}{{ page.date_formatted }}{{ post.date_formatted }}{% endcapture %}
+{% endcomment %}
+{% capture date_formatted %}{{ date | date: site.date_format }}{% endcapture %}
{% capture has_date %}{{ date | size }}{% endcapture %}
{% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %}
@@ -15,4 +17,3 @@
{% if was_updated != '0' %}
{% capture updated %}<time datetime="{{ updated | date_to_xmlschema }}" class="updated">Updated {{ updated_formatted }}</time>{% endcapture %}
{% else %}{% assign updated = false %}{% endif %}
-{% endcomment %}
View
20 _includes/post/tags.html
@@ -0,0 +1,20 @@
+{% assign tags_list = page.tags %}
+{% if tags_list.first[0] == null %}
+ {% comment %}
+ {% for tag in tags_list %}
+ <a href="{{ root_url }}{{ site.tags_path }}#{{ tag }}-ref">{{ tag }} <span>{{ site.tags[tag].size }}</span></a>
+ {% endfor %}
+ {% endcomment %}
+ {% for tag in tags_list %}
+ <a href="{{ root_url }}{{ site.tags_path }}#{{ tag }}-ref">{{ tag }}</span></a>
+ {% endfor %}
+{% else %}
+ {% comment %}
+ {% for tag in tags_list %}
+ <a href="{{ root_url }}{{ site.tags_path }}#{{ tag[0] }}-ref">{{ tag[0] }} <span>{{ tag[1].size }}</span></a>
+ {% endfor %}
+ {% endcomment %}
+ {% for tag in tags_list %}
+ <a href="{{ root_url }}{{ site.tags_path }}#{{ tag[0] }}-ref">{{ tag[0] }}</span></a>
+ {% endfor %}
+{% endif %}
View
6 _layouts/post.html
@@ -9,7 +9,11 @@
<footer>
<p class="meta">
{% include post/author.html %}
- {% include post/date.html %}{% if updated %}{{ updated }}{% else %}{{ kdate }}{% endif %}
+ {% include post/date.html %}{{ time }}
+ {% comment %}
+ {% if updated %}{{ updated }}{% else %}{{ date }}{% endif %}
+ {% endcomment %}
+ {% include post/tags.html %}
{% include post/categories.html %}
</p>
{% unless page.sharing == false %}
View
16 tags.html
@@ -0,0 +1,16 @@
+---
+layout: page
+title: Tags
+footer: false
+---
+
+<div id="blog-archives">
+ {% for tag in site.tags %}
+ <h3 id="{{ tag[0] }}-ref">{{ tag[0] }}<span>[{{ tag[1].size }}]</span></h3>
+ {% for post in tag[1] %}
+ <article>
+ {% include archive_post.html %}
+ </article>
+ {% endfor %}
+ {% endfor %}
+</div>

0 comments on commit 6b5a3ec

Please sign in to comment.
Something went wrong with that request. Please try again.