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)
This commit is contained in:
Pete 2016-07-27 17:11:58 -05:00
parent ce8ece5fc2
commit 0458bf9803
5 changed files with 14 additions and 10 deletions

View File

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

View File

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

View File

@ -11,12 +11,16 @@ layout: base
{% if page.tags.size > 0 %}
<div class="blog-tags">
Tags:
{% if site.link-tags %}
{% for tag in page.tags %}
<a class="tag_list_link" href="/tag/{{ tag }}">{{ tag }}</a>
<a href="/tag/{{ tag }}">{{ tag }}</a>
{% endfor %}
{% else %}
{{ page.tags | join: ", " }}
{% endif %}
</div>
{% endif %}
{{ content }}
{% endif %}
{{ content }}
</article>
<ul class="pager blog-pager">

View File

@ -31,13 +31,9 @@ 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,12 +26,16 @@ 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 site.show-tags %}
{% if post.tags.size > 0 %}
<div class="blog-tags">
Tags:
{% if site.link-tags %}
{% for tag in post.tags %}
<a href="/tag/{{ tag }}">{{ tag }}</a>
{% endfor %}
{% else %}
{{ post.tags | join: ", " }}
{% endif %}
</div>
{% endif %}