~xdavidwu/xdavidwu.link

a770d29a8c5374d458a3db15c6de62c85be7c455 — Michael Rose 6 years ago 44750d2
DRY `categories_max` calculation in categories.html layout
1 files changed, 7 insertions(+), 13 deletions(-)

M _layouts/categories.html
M _layouts/categories.html => _layouts/categories.html +7 -13
@@ 4,13 4,14 @@ layout: archive

{{ content }}

{% assign categories_max = 0 %}
{% for category in site.categories %}
  {% if category[1].size > categories_max %}
    {% assign categories_max = category[1].size %}
  {% endif %}
{% endfor %}

<ul class="taxonomy__index">
  {% assign categories_max = 0 %}
  {% for category in site.categories %}
    {% if category[1].size > categories_max %}
      {% assign categories_max = category[1].size %}
    {% endif %}
  {% endfor %}
  {% for i in (1..categories_max) reversed %}
    {% for category in site.categories %}
      {% if category[1].size == i %}


@@ 24,13 25,6 @@ layout: archive
  {% endfor %}
</ul>

{% assign categories_max = 0 %}
{% for category in site.categories %}
  {% if category[1].size > categories_max %}
    {% assign categories_max = category[1].size %}
  {% endif %}
{% endfor %}

{% for i in (1..categories_max) reversed %}
  {% for category in site.categories %}
    {% if category[1].size == i %}