Merge pull request #9 from 11ty/tag-pages

Adds tag pages example
This commit is contained in:
Zach Leatherman 2018-06-11 08:10:32 -05:00 committed by GitHub
commit af001c7a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 4 deletions

View File

@ -11,5 +11,9 @@
"author": { "author": {
"name": "Your Name Here", "name": "Your Name Here",
"email": "youremailaddress@example.com" "email": "youremailaddress@example.com"
} },
"tagPages": [
"another-tag",
"second-tag"
]
} }

View File

@ -3,7 +3,7 @@
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}"> <li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}">
<a href="{{ post.url | url }}" class="postlist-link">{{ post.data.title }}</a> <a href="{{ post.url | url }}" class="postlist-link">{{ post.data.title }}</a>
<span class="postlist-date">{{ post.date | readableDate }}</span> <span class="postlist-date">{{ post.date | readableDate }}</span>
{% for tag in post.data.tags %}{% if tag != "post" %}<span class="tag">{{ tag }}</span>{% endif %}{% endfor %} {% for tag in post.data.tags %}{% if tag != "post" and metadata.tagPages.indexOf(tag) > -1 %}<a href="/tags/{{ tag }}/" class="tag">{{ tag }}</a>{% endif %}{% endfor %}
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>

View File

@ -168,6 +168,11 @@ pre {
background-color: var(--red); background-color: var(--red);
color: var(--white); color: var(--white);
border-radius: 0.25em; /* 3px /12 */ border-radius: 0.25em; /* 3px /12 */
text-decoration: none;
}
a[href].tag,
a[href].tag:visited {
color: #fff;
} }
/* Warning */ /* Warning */

View File

@ -2,6 +2,7 @@
title: This is my third post. title: This is my third post.
tags: tags:
- post - post
- second-tag
layout: layouts/post.njk layout: layouts/post.njk
--- ---
Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.

13
tags.njk Normal file
View File

@ -0,0 +1,13 @@
---
pagination:
data: metadata.tagPages
size: 1
alias: tag
permalink: /tags/{{ tag }}/
layout: layouts/home.njk
---
<h1>Tagged “{{ tag }}”</h1>
{% set postslist = collections[ tag ] %}
{% include "postslist.njk" %}