make tag list modular, put on homepage
This commit is contained in:
parent
19ad68397b
commit
edb8805bd2
4 changed files with 12 additions and 9 deletions
7
site/_includes/-taglist.njk
Normal file
7
site/_includes/-taglist.njk
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<div style="--totalTags:{{ collections.categories | dictsort | length }}">
|
||||||
|
{%- for tag, data in collections.categories -%}
|
||||||
|
<a class="button tag" style="--tagIndex:{{ collections.categories[tag].id }}" href="/tags/{{ tag | slugify }}/">{{ tag }}
|
||||||
|
<span class="tagCount">{{ data.count }}</span>
|
||||||
|
</a>
|
||||||
|
{%- endfor -%}
|
||||||
|
</div>
|
|
@ -12,13 +12,7 @@ eleventyComputed:
|
||||||
{% set tag = page.fileSlug %}
|
{% set tag = page.fileSlug %}
|
||||||
{% if collections[tag] %}
|
{% if collections[tag] %}
|
||||||
{% if tag === "posts" %}
|
{% if tag === "posts" %}
|
||||||
<div style="--totalTags:{{ collections.categories | dictsort | length }}">
|
{% include "-taglist.njk" %}
|
||||||
{%- for tag, data in collections.categories -%}
|
|
||||||
<a class="button tag" style="--tagIndex:{{ collections.categories[tag].id }}" href="/tags/{{ tag | slugify }}/">{{ tag }}
|
|
||||||
<span class="tagCount">{{ data.count }}</span>
|
|
||||||
</a>
|
|
||||||
{%- endfor -%}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ collectionList(tag) }}
|
{{ collectionList(tag) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -665,7 +665,6 @@ button, a.button {
|
||||||
background-color: var(--c-text-background);
|
background-color: var(--c-text-background);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
margin: 0 0.2em 0.2em 0;
|
|
||||||
border-radius: 0.2rem;
|
border-radius: 0.2rem;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -679,7 +678,9 @@ button, a.button {
|
||||||
0 0 1rem var(--c-accent);
|
0 0 1rem var(--c-accent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.button.tag {
|
||||||
|
margin: 0 0.2em 0.2em 0;
|
||||||
|
}
|
||||||
.tag {
|
.tag {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
&::before {
|
&::before {
|
||||||
|
|
|
@ -7,6 +7,7 @@ layout: "base.njk"
|
||||||
{%- for name, collection in collections -%}
|
{%- for name, collection in collections -%}
|
||||||
{%- if name in ["posts"] -%}
|
{%- if name in ["posts"] -%}
|
||||||
<h2>{{name | capitalize }}</h2>
|
<h2>{{name | capitalize }}</h2>
|
||||||
|
{% include "-taglist.njk" %}
|
||||||
{{ collectionList(name, limit=5) }}
|
{{ collectionList(name, limit=5) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue