From 0458bf9803bcfbaaab2643bd47abff90c50aa0bc Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 27 Jul 2016 17:11:58 -0500 Subject: [PATCH] tagging options Tags will display as plain text if a user adds tags to a post. If user sets 'link-tags: true' in _config.yml, then Jekyll will make a new page for each tag which lists all posts with given tag (provided the site is not deployed through GitHub pages) --- README.md | 2 +- _config.yml | 2 +- _layouts/post.html | 10 +++++++--- _layouts/tag_index.html | 4 ---- index.html | 6 +++++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index fa74195..d0f4d0a 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ To set up a GitHub Project page, simply fork this repository into a branch calle I wrote [a blog post](http://deanattali.com/2015/03/12/beautiful-jekyll-how-to-build-a-site-in-minutes/) describing some more advanced features that I used in my website that are applicable to any Jekyll site. It describes how I used a custom URL for my site (deanattali.com instead of daattali.github.io), how to add a Google-powered search into your site, and provides a few more details about having an RSS feed. -Additionally, if you choose to deploy Jekyll on your own server (such as a DigitalOcean server), you can tell Jekyll to automatically categorize your blog posts by tags. You just need to set `show-tags: true` in `_config.yml`. Jekyll will then generate a new page for each unique tag which lists all of the posts that belong to that tag. +Additionally, if you choose to deploy Jekyll on your own server (such as a DigitalOcean server), you can tell Jekyll to automatically categorize your blog posts by tags. You just need to set `link-tags: true` in `_config.yml`. Jekyll will then generate a new page for each unique tag which lists all of the posts that belong to that tag. ### Featured users (success stories!) diff --git a/_config.yml b/_config.yml index b737e6d..4514762 100644 --- a/_config.yml +++ b/_config.yml @@ -98,7 +98,7 @@ defaults: show-avatar: true # Tags (not recommended if you are deploying via GitHub pages, see README.md) -show-tags: false +link-tags: true # Exclude these files from production site exclude: diff --git a/_layouts/post.html b/_layouts/post.html index e6c8e92..0e8a641 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -11,12 +11,16 @@ layout: base {% if page.tags.size > 0 %}
Tags: + {% if site.link-tags %} {% for tag in page.tags %} - {{ tag }} + {{ tag }} {% endfor %} + {% else %} + {{ page.tags | join: ", " }} + {% endif %}
- {% endif %} - {{ content }} + {% endif %} + {{ content }}