-
Notifications
You must be signed in to change notification settings - Fork 1
/
categories.html
87 lines (76 loc) · 2.96 KB
/
categories.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
layout: cat
title: Podcast Categories
description: Podcast Galleries of Categories
---
{% assign categories_max = 0 %}
{% for category in site.categories %}
{% if category[1].size > categories_max %}
{% assign categories_max = category[1].size %}
{% endif %}
{% endfor %}
{% assign category_names_array = "" %}
{% assign category_counts = "" %}
{% assign first_array_element = true %}
{% for i in (1..categories_max) reversed %}
{% assign category_names = "" %}
{% assign first_category = true %}
{% for category in site.categories %}
{% if category[1].size == i %}
{% if first_category %}
{% assign first_category = false %}
{% else %}
{% assign category_names = category_names | append: "," %}
{% endif %}
{% assign category_names = category_names | append: category[0] %}
{% endif %}
{% endfor %}
{% if category_names != "" %}
{% assign category_names = category_names | split: "," | sort | join: "," %}
{% if first_array_element %}
{% assign first_array_element = false %}
{% else %}
{% assign category_names_array = category_names_array | append: "|" %}
{% assign category_counts = category_counts | append: "|" %}
{% endif %}
{% assign category_names_array = category_names_array | append: category_names %}
{% assign category_counts = category_counts | append: i %}
{% endif %}
{% endfor %}
{% assign category_names_array = category_names_array | split: "|" %}
{% assign category_counts = category_counts | split: "|" %}
<div class="p-3 border-top border-secondary">
{% for category_names in category_names_array %}
{% assign category_names_list = category_names | split: "," %}
{% assign category_count = category_counts[forloop.index0] %}
{% for category_name in category_names_list %}
<div class="row">
<a href="#{{ category_name | slugify }}" class="col-md-2 p-3 btn-orange">
<strong>{{ category_name }}</strong> <span class="orange">{{ category_count }}</span>
</a>
</div>
{% endfor %}
{% endfor %}
</div>
<div class="container">
{% for category_names in category_names_array %}
{% assign category_names_list = category_names | split: "," %}
{% for category_name in category_names_list %}
<section id="{{ category_name | slugify | downcase }}" class="p-3">
<h2>{{ category_name }}</h2>
{% for category in site.categories %}
{% if category[0] == category_name %}
<div class="entries-{{ page.entries_layout | default: 'list' }} row">
{% for entry in category.last %}
{% include entry.html %}
{% endfor %}
</div>
{% endif %}
{% endfor %}
</section>
{% endfor %}
{% endfor %}
</div>
<div class="text-center p-1 mb-5">
<a href="#" class="btn-orange">{{ site.data.text[site.locale].back_to_top | default: 'Back to Top' }} ↑</a>
</div>