option for tags

This commit is contained in:
Pete 2016-07-27 16:46:42 -05:00
parent b90c1c8de9
commit ce8ece5fc2
4 changed files with 13 additions and 3 deletions

View File

@ -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.

View File

@ -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

View File

@ -31,9 +31,13 @@ show-avatar: false
<div class="blog-tags">
Tags:
{% if site.show-tags %}
{% for tag in post.tags %}
<a href="/tag/{{ tag }}">{{ tag }}</a>
{% endfor %}
{% else %}
{{ post.tags | join: ", " }}
{% endif %}
</div>
</article>
{% endif %}

View File

@ -26,7 +26,7 @@ subtitle: This is where I will tell my friends way too much about me
<a href="{{ post.url | prepend: site.baseurl }}" class="post-read-more">[Read&nbsp;More]</a>
</div>
{% if post.tags.size > 0 %}
{% if site.show-tags %}
<div class="blog-tags">
Tags:
{% for tag in post.tags %}
@ -34,6 +34,7 @@ subtitle: This is where I will tell my friends way too much about me
{% endfor %}
</div>
{% endif %}
</article>
{% endfor %}
</div>