Skip to content

Commit 89c7e56

Browse files
Update post-tags.md
1 parent 1152a2f commit 89c7e56

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

recipes/jekyll/snippets/post-tags.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,44 @@
22

33
{% raw %}
44

5+
In the repo this was taken from, there is a listing of all posts and there is a listing of all tags with posts shown under each tag.
56
## Navigation
67

78
```html
89
<a href="{{ '/posts/' | relative_url }}">All Posts</a>
910
<a href="{{ '/tags/' | relative_url }}">All Tags</a>
1011
```
1112

13+
## Tag names and counts
14+
15+
Untested. Based on a theme.
16+
17+
```html
18+
{% for tag in site.tags %}
19+
{% assign name = tag[0] %}
20+
<div>
21+
<span class="term">{{ name }}</span>
22+
<span class="count">{{ site.tags[name].size }}</span>
23+
</div>
24+
{% endfor %}
25+
```
26+
1227

1328
## Tags of a post
1429

15-
List matching tags on the footer of a post.
30+
List matching tags on the footer of a post. The link is only useful if you have a page of all tags and content, since Jekyll does not make standalone pages for each tag.
1631

1732
Add this to your `_layouts/post.html` file.
1833

1934
```html
20-
<span class="entry-tags">
35+
<span >
2136
{% for tag in page.tags %}
2237
<a href="{{ site.url }}/tags/#{{ tag }}" title="Pages tagged {{ tag }}" class="tag">
2338
<span class="term">
2439
{{ tag }}
2540
</span>
2641
</a>
27-
{% endfor %}
42+
{% endfor %}
2843
</span>
2944
```
3045

0 commit comments

Comments
 (0)