From ce8ece5fc24774df89a47acc98dcf1bbe20e4d5b Mon Sep 17 00:00:00 2001 From: Pete Date: Wed, 27 Jul 2016 16:46:42 -0500 Subject: [PATCH] option for tags --- README.md | 2 ++ _config.yml | 3 +++ _layouts/tag_index.html | 6 +++++- index.html | 5 +++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2bc7016..fa74195 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,8 @@ 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. + ### Featured users (success stories!) To my huge surprise, Beautiful Jekyll has been used in over 500 websites in its first 6 months alone! Here is a hand-picked selection of some websites that use Beautiful Jekyll. diff --git a/_config.yml b/_config.yml index 4f94365..b737e6d 100644 --- a/_config.yml +++ b/_config.yml @@ -97,6 +97,9 @@ defaults: layout: "page" show-avatar: true +# Tags (not recommended if you are deploying via GitHub pages, see README.md) +show-tags: false + # Exclude these files from production site exclude: - Gemfile diff --git a/_layouts/tag_index.html b/_layouts/tag_index.html index 2a5ffc4..2d9e199 100644 --- a/_layouts/tag_index.html +++ b/_layouts/tag_index.html @@ -31,9 +31,13 @@ show-avatar: false
Tags: + {% if site.show-tags %} {% for tag in post.tags %} - {{ tag }} + {{ tag }} {% endfor %} + {% else %} + {{ post.tags | join: ", " }} + {% endif %}
{% endif %} diff --git a/index.html b/index.html index da5142d..6a84221 100644 --- a/index.html +++ b/index.html @@ -26,14 +26,15 @@ subtitle: This is where I will tell my friends way too much about me [Read More] - {% if post.tags.size > 0 %} + {% if site.show-tags %}
Tags: {% for tag in post.tags %} - {{ tag }} + {{ tag }} {% endfor %}
{% endif %} + {% endfor %}