fix More link

This commit is contained in:
Joshua Seigler 2025-06-24 09:38:39 -04:00
parent a9ab7eb6ce
commit fed5c2a424
4 changed files with 6 additions and 8 deletions

View file

@ -10,6 +10,6 @@ eleventyComputed:
</section>
{% set tag = page.fileSlug %}
{% if collections[tag] %}
{{ collectionList(collections[tag]) }}
{{ collectionList(tag) }}
{% endif %}
</main>

View file

@ -1,8 +1,8 @@
{%- from "components/tagList.njk" import tagList with context -%}
{% macro collectionList(collection, limit=0) %}
{% macro collectionList(tagName, limit=0) %}
<ul class="collection">
{%- for item in collection | reverse -%}
{%- for item in collections[tagName] | reverse -%}
{%- if (limit === 0 or loop.index <= limit) -%}
<li>
<a href="{{item.url}}">{{item.data.title}}</a>
@ -15,7 +15,7 @@
{%- endif -%}
{%- if (limit !== 0 and loop.index == limit + 1) -%}
<li>
<a href="/{{name}}/">More {{name}}&hellip;</a>
<a href="/{{tagName}}/">More {{tagName}}&hellip;</a>
</li>
{%- endif -%}
{%- endfor -%}

View file

@ -7,7 +7,7 @@ layout: "base.njk"
{%- for name, collection in collections -%}
{%- if name in ["posts"] -%}
<h2>{{name | capitalize }}</h2>
{{ collectionList(collection, limit=5) }}
{{ collectionList(name, limit=5) }}
{%- endif -%}
{%- endfor -%}
</main>

View file

@ -18,7 +18,5 @@ useTitle: true
<section data-pagefind-body>
{{ content | safe }}
</section>
{% if collections[tag] %}
{{ collectionList(collections[tag]) }}
{% endif %}
{{ collectionList(tag) }}
</main>