Style tags table

This commit is contained in:
Oliver Davies 2018-01-30 22:41:47 +00:00
parent d9b6d4fbb8
commit 531a7622ee
2 changed files with 33 additions and 12 deletions
source
_includes/post
blog

View file

@ -1,9 +1,13 @@
{% if page.tags %} {% if page.tags %}
<div class="tags"> <div>
{% for tag in page.tags %} <p>
Tags:
{% for tag in page.tags|sort %}
<a href="{{ site.url }}/blog/tags/{{ tag|url_encode(true) }}" class="blue"> <a href="{{ site.url }}/blog/tags/{{ tag|url_encode(true) }}" class="blue">
{{- tag -}} {{- tag -}}
</a> </a>
{%- if not loop.last %},{% endif %}
{% endfor %} {% endfor %}
</p>
</div> </div>
{% endif %} {% endif %}

View file

@ -5,10 +5,27 @@ title: Tags
use: use:
- posts_tags - posts_tags
--- ---
<h2>Tags</h2> <h1>Blog Tags</h1>
<ul> <div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Tag</th>
<th>Number of posts</th>
</tr>
</thead>
<tbody>
{% for tag, posts in data.posts_tags %} {% for tag, posts in data.posts_tags %}
<li><a href="{{ site.url }}/blog/tags/{{ tag|url_encode(true) }}">{{ tag }}</a></li> <tr>
<td>
<a href="{{ site.url }}/blog/tags/{{ tag|url_encode(true) }}">
{{ tag }}
</a>
</td>
<td>{{ posts|length }}</td>
</tr>
{% endfor %} {% endfor %}
</ul> </tbody>
</table>
</div>