Skip to content

Commit ce8ece5

Browse files
committed
option for tags
1 parent b90c1c8 commit ce8ece5

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ To set up a GitHub Project page, simply fork this repository into a branch calle
148148

149149
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.
150150

151+
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.
152+
151153
### Featured users (success stories!)
152154

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

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ defaults:
9797
layout: "page"
9898
show-avatar: true
9999

100+
# Tags (not recommended if you are deploying via GitHub pages, see README.md)
101+
show-tags: false
102+
100103
# Exclude these files from production site
101104
exclude:
102105
- Gemfile

_layouts/tag_index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ <h4 class="post-subtitle">
3131

3232
<div class="blog-tags">
3333
Tags:
34+
{% if site.show-tags %}
3435
{% for tag in post.tags %}
35-
<a href="/tag/{{ tag }}">{{ tag }}</a>
36+
<a href="/tag/{{ tag }}">{{ tag }}</a>
3637
{% endfor %}
38+
{% else %}
39+
{{ post.tags | join: ", " }}
40+
{% endif %}
3741
</div>
3842
</article>
3943
{% endif %}

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ <h3 class="post-subtitle">
2626
<a href="{{ post.url | prepend: site.baseurl }}" class="post-read-more">[Read&nbsp;More]</a>
2727
</div>
2828

29-
{% if post.tags.size > 0 %}
29+
{% if site.show-tags %}
3030
<div class="blog-tags">
3131
Tags:
3232
{% for tag in post.tags %}
33-
<a href="/tag/{{ tag }}">{{ tag }}</a>
33+
<a href="/tag/{{ tag }}">{{ tag }}</a>
3434
{% endfor %}
3535
</div>
3636
{% endif %}
37+
3738
</article>
3839
{% endfor %}
3940
</div>

0 commit comments

Comments
 (0)