Skip to content

Commit 8ee4f77

Browse files
committed
tags and category
1 parent 1b1fd6d commit 8ee4f77

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

_layouts/post.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,28 @@
22
layout: default
33
---
44

5+
{% if post.tags.size > 0 %}
6+
{% 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 %}
7+
{% for post_tag in post.tags %}
8+
{% for data_tag in site.data.tags %}
9+
{% if data_tag.slug == post_tag %}
10+
{% assign tag = data_tag %}
11+
{% endif %}
12+
{% endfor %}
13+
{% if tag %}
14+
{% capture tags_content_temp %}{{ tags_content }}<a href="/blog/tag/{{ tag.slug }}/">{{ tag.name }}</a>{% if forloop.last == false %}, {% endif %}{% endcapture %}
15+
{% assign tags_content = tags_content_temp %}
16+
{% endif %}
17+
{% endfor %}
18+
{% else %}
19+
{% assign tags_content = '' %}
20+
{% endif %}
21+
522
<article class="post">
623
<h1>{{ page.title }}</h1>
724

825
<div class="entry">
26+
<p id="post-meta">{{ tags_content }}</p>
927
{{ content }}
1028
</div>
1129

_posts/2015-1-1-MongoDB-Notes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
layout: post
33
title: MongoDB最佳实践笔记
44
published: true
5-
categories: [MongoDB, Maizi]
5+
category: MongoDB
6+
tags: [MongoDB, Maizi]
67
---
78

89
主要还得看官网

0 commit comments

Comments
 (0)