Skip to content

Commit

Permalink
Rename tag/category archive variables to avoid possible conflicts wit…
Browse files Browse the repository at this point in the history
…h site.tags and site.categories

- Fixes mmistakes#329
  • Loading branch information
mmistakes authored and sobkowiak committed Jul 18, 2016
1 parent b16cb8e commit 84594af
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ whitelist:
# - <base_path>/tags/my-awesome-tag/index.html ~> path: /tags/
# - <base_path/categories/my-awesome-category/index.html ~> path: /categories/
# - <base_path/my-awesome-category/index.html ~> path: /
categories:
category_archive:
type: liquid
path: /categories/
tags:
tag_archive:
type: liquid
path: /tags/
# https://github.com/jekyll/jekyll-archives
Expand Down
6 changes: 3 additions & 3 deletions _includes/category-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

{% include base_path %}

{% case site.categories.type %}
{% case site.category_archive.type %}
{% when "liquid" %}
{% assign path_type = "#" %}
{% when "jekyll-archives" %}
{% assign path_type = nil %}
{% endcase %}

{% if site.categories.path %}
{% if site.category_archive.path %}
{% comment %}
<!-- Sort alphabetically regardless of case e.g. a B c d E -->
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
Expand All @@ -23,7 +23,7 @@
{% 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: 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 %}
</span>
</p>
Expand Down
4 changes: 2 additions & 2 deletions _includes/page__taxonomy.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% include base_path %}

{% if site.tags.type and page.tags[0] %}
{% if site.tag_archive.type and page.tags[0] %}
{% include tag-list.html %}
{% endif %}

{% if site.categories.type and page.categories[0] %}
{% if site.category_archive.type and page.categories[0] %}
{% include category-list.html %}
{% endif %}
6 changes: 3 additions & 3 deletions _includes/tag-list.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% include base_path %}

{% case site.tags.type %}
{% case site.tag_archive.type %}
{% when "liquid" %}
{% assign path_type = "#" %}
{% when "jekyll-archives" %}
{% assign path_type = nil %}
{% endcase %}

{% if site.tags.path %}
{% if site.tag_archive.path %}
{% comment %}
<!-- Sort alphabetically regardless of case e.g. a B c d E -->
<!-- modified from http://www.codeofclimber.ru/2015/sorting-site-tags-in-jekyll/ -->
Expand All @@ -21,7 +21,7 @@
{% 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: 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 %}
</span>
</p>
Expand Down

0 comments on commit 84594af

Please sign in to comment.