diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-06-10 11:01:19 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2020-06-10 11:01:19 +0200 |
commit | 13934914c0cf8bf359938dcc19dbea82fe33db61 (patch) | |
tree | 5c50f47555f10efd4beed8f2546e7146a91571c5 | |
parent | 624592d43e23bd26c3da30e255257b652d0e33ed (diff) |
Implement tag pages
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 5 | ||||
-rw-r--r-- | _config.yml | 8 | ||||
-rw-r--r-- | _includes/posts-intro.md | 26 | ||||
-rw-r--r-- | _layouts/archive.html | 40 | ||||
-rw-r--r-- | _layouts/post.html | 13 | ||||
-rw-r--r-- | _pages/posts.html | 28 |
7 files changed, 89 insertions, 33 deletions
@@ -7,3 +7,5 @@ source "https://rubygems.org" do gem "redcarpet" gem "therubyracer" end + +gem "jekyll-archives", "~> 2.2" diff --git a/Gemfile.lock b/Gemfile.lock index ea872bb..3f4003a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,6 +31,8 @@ GEM rouge (~> 3.0) safe_yaml (~> 1.0) terminal-table (~> 1.8) + jekyll-archives (2.2.1) + jekyll (>= 3.6, < 5.0) jekyll-asciidoc (3.0.0) asciidoctor (>= 1.5.0) jekyll (>= 3.0.0) @@ -83,6 +85,7 @@ PLATFORMS DEPENDENCIES jekyll! + jekyll-archives (~> 2.2) jekyll-asciidoc! jekyll-less! jekyll-sitemap! @@ -91,4 +94,4 @@ DEPENDENCIES therubyracer! BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/_config.yml b/_config.yml index bb8ab77..ccd4979 100644 --- a/_config.yml +++ b/_config.yml @@ -19,6 +19,7 @@ baseurl: "" # the subpath of your site, e.g. /blog url: "https://www.tyil.nl" # the base hostname & protocol for your site permalink: pretty plugins: + - jekyll-archives - jekyll-asciidoc - jekyll-sitemap - pygments.rb @@ -48,6 +49,13 @@ collections: slides: output: false +jekyll-archives: + enabled: + - tags + layout: archive + permalinks: + tag: /tag/:name/ + # Give all posts a feed = true attribute for easy feed-generating defaults: - scope: diff --git a/_includes/posts-intro.md b/_includes/posts-intro.md new file mode 100644 index 0000000..17a4dbf --- /dev/null +++ b/_includes/posts-intro.md @@ -0,0 +1,26 @@ +{% markdown %} +I sometimes write articles to refer to. It saves a lot of time compared to +explaining the same thing over and over again. As such, most articles will +probably be little rants. All of the articles I wrote have been made public on +my site, and can be found below, in alphabetical order. + +If you wish to respond to any article, whether it be criticism, reporting +mistakes or simply because you want to discuss the points, feel free to send me +an email. My email address is listed [on the homepage][home]. If you do, +consider adding a PGP signature or sending it encrypted with [my pgp key][pgp]. +All feedback is greatly appreciated, so do not hesitate to contact me to give +me yours. + +These articles are available under the [Creative Commons (CC BY-SA +3.0)][cc-by-sa] license, which means you are free to use it for any purpose so +long as you keep attribution to me (and preferably also just link to the +original article) and do not relicense the article. + +I'd also like to note that these articles reflect my opinion, and only mine. +Please refrain from accusing other people of holding my opinion for simply +being referenced in my articles. + +[cc-by-sa]: https://creativecommons.org/licenses/by-sa/3.0/ +[home]: / +[pgp]: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x7A6AC285E2D98827 +{% endmarkdown %} diff --git a/_layouts/archive.html b/_layouts/archive.html new file mode 100644 index 0000000..4c30f96 --- /dev/null +++ b/_layouts/archive.html @@ -0,0 +1,40 @@ +--- +layout: default +--- + +{% markdown %} +## Blog posts tagged with #{{ page.title | slugify }} +{% endmarkdown %} + +{% include posts-intro.md %} + +{% for post in page.posts %} + {% if post.wip %}{% continue %}{% endif %} + {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} + {% capture next_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %} + + {% if forloop.first %} + <h3>{{ this_year }}</h3> + <ul> + {% endif %} + + <li> + <a href="{{ post.url }}">{{ post.title }}</a> + <small> + {{ post.date | date: "%Y-%m-%d" }} + {% for tag in post.tags %} + <a href="{{ site.baseurl | prepend: site.url }}/tag/{{ tag | slugify }}">#{{ tag | slugify }}</a> + {% endfor %} + </small> + </li> + + {% if forloop.last %} + </ul> + {% else %} + {% if this_year != next_year %} + </ul> + <h3>{{ next_year }}</h3> + <ul> + {% endif %} + {% endif %} +{% endfor %} diff --git a/_layouts/post.html b/_layouts/post.html index 3cddce3..d979adb 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -6,14 +6,13 @@ layout: default <header> <h1> {{ page.title }} - <br> - <small> - {% if page.wip %}Work in progress!{% endif %} - {% for tag in page.tags %} - #{{ tag }} - {% endfor %} - </small> + {% if page.wip %}<small>Work in progress!</small>{% endif %} </h1> + <small> + {% for tag in page.tags %} + <a href="{{ site.baseurl | prepend: site.url }}/tag/{{ tag | slugify }}">#{{ tag | slugify }}</a> + {% endfor %} + </small> </header> <main> {{ content }} diff --git a/_pages/posts.html b/_pages/posts.html index 48bc522..98b61b5 100644 --- a/_pages/posts.html +++ b/_pages/posts.html @@ -9,32 +9,10 @@ description: > {% markdown %} ## Blog posts -I sometimes write articles to refer to. It saves a lot of time compared to -explaining the same thing over and over again. As such, most articles will -probably be little rants. All of the articles I wrote have been made public on -my site, and can be found below, in alphabetical order. - -If you wish to respond to any article, whether it be criticism, reporting -mistakes or simply because you want to discuss the points, feel free to send me -an email. My email address is listed [on the homepage][home]. If you do, -consider adding a PGP signature or sending it encrypted with [my pgp key][pgp]. -All feedback is greatly appreciated, so do not hesitate to contact me to give -me yours. - -These articles are available under the [Creative Commons (CC BY-SA -3.0)][cc-by-sa] license, which means you are free to use it for any purpose so -long as you keep attribution to me (and preferably also just link to the -original article) and do not relicense the article. - -I'd also like to note that these articles reflect my opinion, and only mine. -Please refrain from accusing other people of holding my opinion for simply -being referenced in my articles. - -[cc-by-sa]: https://creativecommons.org/licenses/by-sa/3.0/ -[home]: / -[pgp]: http://pgp.mit.edu/pks/lookup?op=vindex&search=0x7A6AC285E2D98827 {% endmarkdown %} +{% include posts-intro.md %} + {% for post in site.posts %} {% if post.wip %}{% continue %}{% endif %} {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} @@ -50,7 +28,7 @@ being referenced in my articles. <small> {{ post.date | date: "%Y-%m-%d" }} {% for tag in post.tags %} - #{{ tag }} + <a href="{{ site.baseurl | prepend: site.url }}/tag/{{ tag | slugify }}">#{{ tag | slugify}}</a> {% endfor %} </small> </li> |