feat: add tag page
This commit is contained in:
parent
210a278ab1
commit
5e72b839fe
5 changed files with 52 additions and 3 deletions
|
@ -7,7 +7,11 @@ layout: base
|
|||
<time class="[ date ]" datetime="{{ date }}">{{ date | formatDate("MMMM D, YYYY") }}</time>
|
||||
<h1>{{ title }}</h1>
|
||||
<ul class="[ categories ]">
|
||||
{% for category in categories %}<li>{{ category }}</li>{% endfor %}
|
||||
{% for category in categories %}
|
||||
<li>
|
||||
<a href="/tag/{{ category }}">{{ category }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</header>
|
||||
{{ content | safe }}
|
||||
|
|
|
@ -3,5 +3,14 @@ permalink: /posts/index.html
|
|||
layout: "base"
|
||||
---
|
||||
|
||||
{% for post in collections.posts %}{{ post.fileSlug }}{% endfor %}
|
||||
Here are all my posts!
|
||||
<h1>All posts</h1>
|
||||
<p>
|
||||
View all <a href="/tags">tags</a>
|
||||
</p>
|
||||
<ul>
|
||||
{% for post in collections.posts %}
|
||||
<li>
|
||||
<a href={{ post.url }}>{{ post.data.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
17
src/content/pages/tag.html
Normal file
17
src/content/pages/tag.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
pagination:
|
||||
data: collections.postsByCategory
|
||||
size: 1
|
||||
alias: tag
|
||||
permalink: /tag/{{ tag }}/index.html
|
||||
layout: "base"
|
||||
---
|
||||
|
||||
{% set posts = collections.postsByCategory[tag] %}
|
||||
<h1>Tag: {{ tag }}</h1>
|
||||
<ul>
|
||||
{% for post in posts %}
|
||||
<li>
|
||||
<a href="{{ post.url }}">{{ post.data.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue