feat: update tags to order by count

This commit is contained in:
Devin Haska 2024-02-11 14:31:32 -08:00
parent 58d679d3c9
commit 2eed920716
10 changed files with 72 additions and 40 deletions

View file

@ -1,20 +1,14 @@
---
eleventyComputed:
title: "Tag: {{ tag }}"
title: "Tag: {{ category.title }}"
permalink: "{{ category.href }}/index.html"
layout: base
pagination:
data: collections.postsByCategory
data: collections.categories
size: 1
alias: tag
permalink: /tag/{{ tag }}/index.html
alias: category
---
{% set posts = collections.postsByCategory[tag] %}
<h1>Tag: {{ tag }}</h1>
<ul>
{% for post in posts %}
<li>
<a href="{{ post.url }}">{{ post.data.title }}</a>
</li>
{% endfor %}
</ul>
<h1>Tag: {{ category.title }}</h1>
{% set items = collections.posts | filterByCategory(category.title) %}
{% include "partials/archive.html" %}

View file

@ -5,14 +5,12 @@ title: All tags
---
<section class="[ flow ]">
<h1>Tags</h1>
{% set categories = collections.categories | entries %}
<ol class="[ flex gap-1 list-none p-0 mb-0 ]">
{% for tag in categories %}
{% set key = tag | first %}
{% set count = tag | last %}
<h1>{{ title }}</h1>
<ol class="[ flex flex-wrap gap-0.5 list-none p-0 mb-0 ]">
{% for category in collections.categories %}
<li>
<a href="/tag/{{ key }}" class="[ pill ] [ flex px-1 py-0.5 gap-0.5 ]">{{ key }} <span class="[ pill-count ]">{{ count }}</span></a>
<a href="{{ category.href }}"
class="[ pill ] [ flex px-1 py-0.5 gap-0.5 ]">{{ category.title }} <span class="[ pill-count ]">{{ category.count }}</span></a>
</li>
{% endfor %}
</ol>