~royston/codsen.com

codsen.com/src/tags.njk -rw-r--r-- 2.1 KiB
86865e46Roy Revelt escape the examples code a month ago
                                                                                
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
---
layout: list
extraContainerClass: layout-page-tag
description: Categories page description
pagination:
  data: collections
  size: 1
  alias: tag
permalink: /articles/tag/{{ tag | slug }}/
---
{% if tag !== 'all' %}
  <div class="layout-page-tag-single">
    <div class="head">
      <h1 class="large-hash"><span class="pr">{{ tag | breakDashes | safe }}<sup title="{{ collections[tag].length }} tags published" aria-label="{{ collections[tag].length }} tags published">Σ={{ collections[tag].length }}</sup></span></h1>
      <div class="head__extras">
        <a class="button secondary" href="/articles/tag/all/">See all tags</a>
      </div>
    </div>

    <section>
        {% for article in collections[tag] | reverse %}

        {% set type = "article" %}
        {% if article.data.type %}

          {% set type = "article" %}
          {% if article.data.type %}
            {% set type = article.data.type %}
          {% endif %}

        {% endif %}

        {% include "src/components/home-article.njk" %}

        {% endfor %}
    </section>
  </div>
{% else %}
  <div class="layout-page-tag-all">
    <h1>
      <span class="all-tags__all">All</span> <span class="all-tags__tags pr">tags<sup title="{{ collections.tagList | length }} tags published" aria-label="{{ collections.tagList | length }} tags published">Σ={{ collections.tagList | length }}</sup></span>
    </h1>
    <div class="all-tags__content">
      <section>
        <h2>a-z</h2>
        <ul>
          {% for tag in collections.tagList | sort %}
            {% set tagUrl %}/articles/tag/{{ tag }}/{% endset %}
            <li><a href="{{ tagUrl | url }}" class="tag">{{ tag }}</a> ({{ collections[tag].length }})</li>
          {% endfor %}
        </ul>
      </section>
      <section>
        <h2>by count</h2>
        <ul>
          {% for tag in collections.tagListSortedByCount %}
            {% set tagUrl %}/articles/tag/{{ tag }}/{% endset %}
            <li><a href="{{ tagUrl | url }}" class="tag">{{ tag }}</a> ({{ collections[tag].length }})</li>
          {% endfor %}
        </ul>
      </section>
    </div>
  </div>
{% endif %}