categories.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. layout: archive
  3. ---
  4. {{ content }}
  5. {% assign categories_max = 0 %}
  6. {% for category in site.categories %}
  7. {% if category[1].size > categories_max %}
  8. {% assign categories_max = category[1].size %}
  9. {% endif %}
  10. {% endfor %}
  11. <ul class="taxonomy__index">
  12. {% for i in (1..categories_max) reversed %}
  13. {% for category in site.categories %}
  14. {% if category[1].size == i %}
  15. <li>
  16. <a href="#{{ category[0] | slugify }}">
  17. <strong>{{ category[0] }}</strong> <span class="taxonomy__count">{{ i }}</span>
  18. </a>
  19. </li>
  20. {% endif %}
  21. {% endfor %}
  22. {% endfor %}
  23. </ul>
  24. {% assign entries_layout = page.entries_layout | default: 'list' %}
  25. {% for i in (1..categories_max) reversed %}
  26. {% for category in site.categories %}
  27. {% if category[1].size == i %}
  28. <section id="{{ category[0] | slugify | downcase }}" class="taxonomy__section">
  29. <h2 class="archive__subtitle">{{ category[0] }}</h2>
  30. <div class="entries-{{ entries_layout }}">
  31. {% for post in category.last %}
  32. {% include archive-single.html type=entries_layout %}
  33. {% endfor %}
  34. </div>
  35. <a href="#page-title" class="back-to-top">{{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} &uarr;</a>
  36. </section>
  37. {% endif %}
  38. {% endfor %}
  39. {% endfor %}