Add page taxonomy links for tags and categories
- Customizable text via _data file - Enable/disable links by setting archive page filenames in _config.yml
This commit is contained in:
parent
f63b8fe294
commit
4427cf4c8e
10 changed files with 56 additions and 29 deletions
|
@ -177,6 +177,10 @@ paginate: 5 # amount of posts to show
|
|||
paginate_path: /page:num/
|
||||
timezone: America/New_York # http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
|
||||
# Archive Page Filenames (example: <base_path>/archive-filename/ ~> "archive-filename")
|
||||
tags_archive_filename : "tag-archive"
|
||||
categories_archive_filename : "category-archive"
|
||||
|
||||
# HTML Compression
|
||||
# http://jch.penibelst.de/
|
||||
compress_html:
|
||||
|
|
|
@ -3,16 +3,18 @@
|
|||
# English (default)
|
||||
# -----------------
|
||||
en: &DEFAULT_EN
|
||||
pagination_previous: "Previous"
|
||||
pagination_next: "Next"
|
||||
toc_label: "Overview"
|
||||
ext_link_label: "Direct Link"
|
||||
share_on: "Share on"
|
||||
date_label: "Last Updated:"
|
||||
related_label: "You May Also Enjoy"
|
||||
follow_label: "Follow:"
|
||||
feed_label: "Feed"
|
||||
powered_by: "Powered by"
|
||||
pagination_previous : "Previous"
|
||||
pagination_next : "Next"
|
||||
toc_label : "Overview"
|
||||
ext_link_label : "Direct Link"
|
||||
share_on_label : "Share on"
|
||||
date_label : "Last Updated:"
|
||||
tags_label : "Tags:"
|
||||
categories_label : "Categories:"
|
||||
related_label : "You May Also Enjoy"
|
||||
follow_label : "Follow:"
|
||||
feed_label : "Feed"
|
||||
powered_by : "Powered by"
|
||||
en_US:
|
||||
<<: *DEFAULT_EN
|
||||
en_UK:
|
||||
|
|
|
@ -1,15 +1,34 @@
|
|||
{% include base_path %}
|
||||
|
||||
{% comment %}
|
||||
<!-- Sort page.tags alphabetically regardless of case e.g. a B c d E -->
|
||||
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
|
||||
{% endcomment %}
|
||||
|
||||
{% capture page_tags %}{% for tag in page.tags %}{{ tag | downcase }}#{{ tag }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
|
||||
{% assign tag_hashes = (page_tags | split: ',' | sort:0) %}
|
||||
{% if site.tags_archive_filename %}
|
||||
{% capture page_tags %}{% for tag in page.tags %}{{ tag | downcase }}#{{ tag }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
|
||||
{% assign tag_hashes = (page_tags | split: ',' | sort:0) %}
|
||||
|
||||
Filed under: <span class="post__taxonomy-wrapper" itemprop="keywords">
|
||||
{% for hash in tag_hashes %}
|
||||
{% assign keyValue = hash | split: '#' %}
|
||||
{% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
|
||||
{% if forloop.last %} and{% endif %} <a href="{{ site.url }}{{ tag_word | slugify | prepend: '/tag/' | append: '/' }}" class="post__taxonomy-item" rel="tag">{{ tag_word }}</a>{% unless forloop.last %}, {% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
<p><strong>{{ site.data.ui-text[site.locale].tags_label }}</strong> <span class="page__taxonomy-wrapper" itemprop="keywords">
|
||||
{% for hash in tag_hashes %}
|
||||
{% assign keyValue = hash | split: '#' %}
|
||||
{% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
|
||||
<a href="{{ base_path }}{{ tag_word | slugify | prepend: '/#' | prepend: site.tags_archive_filename | prepend: "/" }}" class="page__taxonomy-item" rel="tag">{{ tag_word }}</a>{% unless forloop.last %}, {% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if site.categories_archive_filename %}
|
||||
{% capture page_categories %}{% for category in page.categories %}{{ category | downcase }}#{{ category }}{% unless forloop.last %},{% endunless %}{% endfor %}{% endcapture %}
|
||||
{% assign category_hashes = (page_categories | split: ',' | sort:0) %}
|
||||
|
||||
<p><strong>{{ site.data.ui-text[site.locale].categories_label }}</strong> <span class="page__taxonomy-wrapper" itemprop="keywords">
|
||||
{% for hash in category_hashes %}
|
||||
{% assign keyValue = hash | split: '#' %}
|
||||
{% capture category_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
|
||||
<a href="{{ base_path }}{{ category_word | slugify | prepend: '/#' | prepend: site.categories_archive_filename | prepend: "/" }}" class="page__taxonomy-item" rel="tag">{{ category_word }}</a>{% unless forloop.last %}, {% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</p>
|
||||
{% endif %}
|
|
@ -19,12 +19,14 @@ layout: default
|
|||
{% if page.link %}<div><a href="{{ page.link }}" class="btn">{{ site.data.ui-text[site.locale].ext_link_label }}</a></div>{% endif %}
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
{% if site.share and page.share %}{% include social-share.html %}{% endif %}
|
||||
{% if site.share and page.share %}{% include social-share.html %}{% endif %}
|
||||
|
||||
<footer class="page__meta">
|
||||
{% include page__taxonomy.html %}
|
||||
{% if page.modified %}
|
||||
<p class="byline"><strong>{{ site.data.ui-text[site.locale].date_label }}</strong> <time datetime="{{ page.modified | date: "%Y-%m-%d" }}">{{ page.modified | date: "%B %d, %Y" }}</time></p>
|
||||
<p class="page__date"><strong>{{ site.data.ui-text[site.locale].date_label }}</strong> <time datetime="{{ page.modified | date: "%Y-%m-%d" }}">{{ page.modified | date: "%B %d, %Y" }}</time></p>
|
||||
{% elsif page.date %}
|
||||
<p class="byline"><strong>{{ site.data.ui-text[site.locale].date_label }}</strong> <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %d, %Y" }}</time></p>
|
||||
<p class="page__date"><strong>{{ site.data.ui-text[site.locale].date_label }}</strong> <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %d, %Y" }}</time></p>
|
||||
{% endif %}
|
||||
</footer>
|
||||
</div><!-- /.article-wrap -->
|
||||
|
|
|
@ -10,7 +10,7 @@ author_profile: false
|
|||
|
||||
{% for category in group_names %}
|
||||
{% assign posts = group_items[forloop.index0] %}
|
||||
<h2 class="archive__subtitle">{{ category }}</h2>
|
||||
<h2 id="{{ category | slugify }}" class="archive__subtitle">{{ category }}</h2>
|
||||
{% for post in posts %}
|
||||
{% include archive-list-single.html %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -12,7 +12,7 @@ author_profile: false
|
|||
{% unless collection.output == false or collection.label == 'posts' %}
|
||||
{% capture label %}{{ collection.label }}{% endcapture %}
|
||||
{% if label != written_label %}
|
||||
<h2 class="archive__subtitle">{{ label }}</h2>
|
||||
<h2 id="{{ label | slugify }}" class="archive__subtitle">{{ label }}</h2>
|
||||
{% capture written_label %}{{ label }}{% endcapture %}
|
||||
{% endif %}
|
||||
{% endunless %}
|
||||
|
|
|
@ -9,7 +9,7 @@ permalink: /portfolio/
|
|||
|
||||
{% for category in group_names %}
|
||||
{% assign posts = group_items[forloop.index0] %}
|
||||
<h2 class="archive__subtitle">{{ category }}</h2>
|
||||
<h2 id="{{ category | slugify }}" class="archive__subtitle">{{ category }}</h2>
|
||||
{% for post in posts %}
|
||||
{% include archive-list-single.html %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -10,7 +10,7 @@ author_profile: false
|
|||
|
||||
{% for category in group_names %}
|
||||
{% assign posts = group_items[forloop.index0] %}
|
||||
<h2 class="archive__subtitle">{{ category }}</h2>
|
||||
<h2 id="{{ category | slugify }}" class="archive__subtitle">{{ category }}</h2>
|
||||
{% for post in posts %}
|
||||
{% include archive-list-single.html %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -10,7 +10,7 @@ author_profile: false
|
|||
|
||||
{% for tag in group_names %}
|
||||
{% assign posts = group_items[forloop.index0] %}
|
||||
<h2 class="archive__subtitle">{{ tag }}</h2>
|
||||
<h2 id="{{ tag | slugify }}" class="archive__subtitle">{{ tag }}</h2>
|
||||
{% for post in posts %}
|
||||
{% include archive-list-single.html %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -10,7 +10,7 @@ author_profile: false
|
|||
{% for post in site.posts %}
|
||||
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
|
||||
{% if year != written_year %}
|
||||
<h2 class="archive__subtitle">{{ year }}</h2>
|
||||
<h2 id="{{ year | slugify }}" class="archive__subtitle">{{ year }}</h2>
|
||||
{% capture written_year %}{{ year }}{% endcapture %}
|
||||
{% endif %}
|
||||
{% include archive-list-single.html %}
|
||||
|
|
Loading…
Reference in a new issue