From 75243f298d47da02f27a62da6c7a6e018178d89d Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Mon, 11 Jun 2018 08:08:15 -0500 Subject: [PATCH] Adds tag pages example --- _data/metadata.json | 6 +++++- _includes/postslist.njk | 4 ++-- css/index.css | 7 ++++++- posts/thirdpost.md | 1 + tags.njk | 13 +++++++++++++ 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 tags.njk diff --git a/_data/metadata.json b/_data/metadata.json index 415d5e7..9ce0ad2 100644 --- a/_data/metadata.json +++ b/_data/metadata.json @@ -11,5 +11,9 @@ "author": { "name": "Your Name Here", "email": "youremailaddress@example.com" - } + }, + "tagPages": [ + "another-tag", + "second-tag" + ] } diff --git a/_includes/postslist.njk b/_includes/postslist.njk index bdaa453..8c7ec22 100644 --- a/_includes/postslist.njk +++ b/_includes/postslist.njk @@ -3,7 +3,7 @@
  • {{ post.data.title }} {{ post.date | readableDate }} - {% for tag in post.data.tags %}{% if tag != "post" %}{{ tag }}{% endif %}{% endfor %} + {% for tag in post.data.tags %}{% if tag != "post" and metadata.tagPages.indexOf(tag) > -1 %}{{ tag }}{% endif %}{% endfor %}
  • {% endfor %} - \ No newline at end of file + diff --git a/css/index.css b/css/index.css index 5459a5b..6bdbf72 100644 --- a/css/index.css +++ b/css/index.css @@ -168,6 +168,11 @@ pre { background-color: var(--red); color: var(--white); border-radius: 0.25em; /* 3px /12 */ + text-decoration: none; +} +a[href].tag, +a[href].tag:visited { + color: #fff; } /* Warning */ @@ -177,4 +182,4 @@ pre { } .warning ol:only-child { margin: 0; -} \ No newline at end of file +} diff --git a/posts/thirdpost.md b/posts/thirdpost.md index ec4e1a0..4951a7f 100644 --- a/posts/thirdpost.md +++ b/posts/thirdpost.md @@ -2,6 +2,7 @@ title: This is my third post. tags: - post + - second-tag 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. diff --git a/tags.njk b/tags.njk new file mode 100644 index 0000000..9aacb09 --- /dev/null +++ b/tags.njk @@ -0,0 +1,13 @@ +--- +pagination: + data: metadata.tagPages + size: 1 + alias: tag +permalink: /tags/{{ tag }}/ +layout: layouts/home.njk +--- + +

    Tagged “{{ tag }}”

    + +{% set postslist = collections[ tag ] %} +{% include "postslist.njk" %}