Create tag page, some more styling

This commit is contained in:
Lewis Dale 2024-01-08 20:43:56 +00:00
parent 3616eb0d95
commit 91fac7b4c7
4 changed files with 32 additions and 1 deletions

View File

@ -47,6 +47,9 @@ module.exports = function() {
return { return {
notes, notes,
hashtags hashtags: Object.keys(hashtags).map(tag => ({
tag,
notes: hashtags[tag]
}))
}; };
} }

View File

@ -3,6 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>{{ title | safe }}</title>
<link rel="stylesheet" href="/styles/reset.css" /> <link rel="stylesheet" href="/styles/reset.css" />
<link rel="stylesheet" href="/styles/main.css" /> <link rel="stylesheet" href="/styles/main.css" />
</head> </head>

View File

@ -41,6 +41,8 @@ body {
main { main {
height: 100%; height: 100%;
max-width: var(--screen-lg);
margin: 0 auto;
padding: var(--space-size-m); padding: var(--space-size-m);
} }

25
src/tags.njk Normal file
View File

@ -0,0 +1,25 @@
---
layout: base.njk
pagination:
data: notes.hashtags
size: 1
alias: hashtag
eleventyComputed:
permalink: "/tags/{{ hashtag.tag }}/"
title: "#{{ hashtag.tag }}"
---
<main>
<h1>All notes for #{{ hashtag.tag }}</h1>
<ul>
{% for note in hashtag.notes %}
<li>
<div>
{{ note.text | md | safe }}
<a href="/notes/{{ note.id }}">Permalink</a>
</div>
</li>
{% endfor %}
</main>