Rename tag/category archive variables to avoid possible conflicts with site.tags and site.categories

- Fixes #329
This commit is contained in:
Michael Rose 2016-05-29 21:12:24 -04:00
parent 21d15c9cf9
commit 45f3a7a8ee
4 changed files with 10 additions and 10 deletions

View file

@ -179,10 +179,10 @@ whitelist:
# - <base_path>/tags/my-awesome-tag/index.html ~> path: /tags/ # - <base_path>/tags/my-awesome-tag/index.html ~> path: /tags/
# - <base_path/categories/my-awesome-category/index.html ~> path: /categories/ # - <base_path/categories/my-awesome-category/index.html ~> path: /categories/
# - <base_path/my-awesome-category/index.html ~> path: / # - <base_path/my-awesome-category/index.html ~> path: /
categories: category_archive:
type: liquid type: liquid
path: /categories/ path: /categories/
tags: tag_archive:
type: liquid type: liquid
path: /tags/ path: /tags/
# https://github.com/jekyll/jekyll-archives # https://github.com/jekyll/jekyll-archives

View file

@ -2,14 +2,14 @@
{% include base_path %} {% include base_path %}
{% case site.categories.type %} {% case site.category_archive.type %}
{% when "liquid" %} {% when "liquid" %}
{% assign path_type = "#" %} {% assign path_type = "#" %}
{% when "jekyll-archives" %} {% when "jekyll-archives" %}
{% assign path_type = nil %} {% assign path_type = nil %}
{% endcase %} {% endcase %}
{% if site.categories.path %} {% if site.category_archive.path %}
{% comment %} {% comment %}
<!-- Sort alphabetically regardless of case e.g. a B c d E --> <!-- Sort alphabetically regardless of case e.g. a B c d E -->
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ --> <!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
@ -23,7 +23,7 @@
{% for hash in category_hashes %} {% for hash in category_hashes %}
{% assign keyValue = hash | split: '#' %} {% assign keyValue = hash | split: '#' %}
{% capture category_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %} {% capture category_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
<a href="{{ base_path }}{{ category_word | slugify | prepend: path_type | prepend: site.categories.path }}" class="page__taxonomy-item" rel="tag">{{ category_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %} <a href="{{ base_path }}{{ category_word | slugify | prepend: path_type | prepend: site.category_archive.path }}" class="page__taxonomy-item" rel="tag">{{ category_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
{% endfor %} {% endfor %}
</span> </span>
</p> </p>

View file

@ -1,9 +1,9 @@
{% include base_path %} {% include base_path %}
{% if site.tags.type and page.tags[0] %} {% if site.tag_archive.type and page.tags[0] %}
{% include tag-list.html %} {% include tag-list.html %}
{% endif %} {% endif %}
{% if site.categories.type and page.categories[0] %} {% if site.category_archive.type and page.categories[0] %}
{% include category-list.html %} {% include category-list.html %}
{% endif %} {% endif %}

View file

@ -1,13 +1,13 @@
{% include base_path %} {% include base_path %}
{% case site.tags.type %} {% case site.tag_archive.type %}
{% when "liquid" %} {% when "liquid" %}
{% assign path_type = "#" %} {% assign path_type = "#" %}
{% when "jekyll-archives" %} {% when "jekyll-archives" %}
{% assign path_type = nil %} {% assign path_type = nil %}
{% endcase %} {% endcase %}
{% if site.tags.path %} {% if site.tag_archive.path %}
{% comment %} {% comment %}
<!-- Sort alphabetically regardless of case e.g. a B c d E --> <!-- Sort alphabetically regardless of case e.g. a B c d E -->
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ --> <!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
@ -21,7 +21,7 @@
{% for hash in tag_hashes %} {% for hash in tag_hashes %}
{% assign keyValue = hash | split: '#' %} {% assign keyValue = hash | split: '#' %}
{% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %} {% capture tag_word %}{{ keyValue[1] | strip_newlines }}{% endcapture %}
<a href="{{ base_path }}{{ tag_word | slugify | prepend: path_type | prepend: site.tags.path }}" class="page__taxonomy-item" rel="tag">{{ tag_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %} <a href="{{ base_path }}{{ tag_word | slugify | prepend: path_type | prepend: site.tag_archive.path }}" class="page__taxonomy-item" rel="tag">{{ tag_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
{% endfor %} {% endfor %}
</span> </span>
</p> </p>