~xdavidwu/xdavidwu.link

45f3a7a8eef78538518e8aa8bab2c2ec7ca912e9 — Michael Rose 8 years ago 21d15c9
Rename tag/category archive variables to avoid possible conflicts with site.tags and site.categories
- Fixes #329
4 files changed, 10 insertions(+), 10 deletions(-)

M _config.yml
M _includes/category-list.html
M _includes/page__taxonomy.html
M _includes/tag-list.html
M _config.yml => _config.yml +2 -2
@@ 179,10 179,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

M _includes/category-list.html => _includes/category-list.html +3 -3
@@ 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/ -->


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

M _includes/page__taxonomy.html => _includes/page__taxonomy.html +2 -2
@@ 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 %}
\ No newline at end of file

M _includes/tag-list.html => _includes/tag-list.html +3 -3
@@ 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/ -->


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