agnes-love/notes.njk
2026-06-25 00:57:39 +00:00

48 lines
1.8 KiB
Text
Executable file

---
layout: layouts/base.njk
title: Notes
pagination:
data: collections.notes
size: 10
alias: items
reverse: true
permalink: "/notes/{% if pagination.pageNumber > 0 %}page-{{ pagination.pageNumber + 1 }}/{% endif %}"
---
<h1 class="text-2xl font-bold mb-4">Notes</h1>
<p class="text-gray-600 dark:text-gray-400 mb-6">Short, linkable thoughts. Each note has its own permalink.</p>
{% set items = items | default([]) %}
{% if (items | length) == 0 %}
<p class="text-gray-500 dark:text-gray-400 italic">No notes yet. Add files under <code>src/notes/</code>.</p>
{% else %}
<section class="space-y-6">
{% for item in items %}
<article class="border-b pb-4 h-entry">
<h2 class="text-lg font-semibold"><a class="u-url" href="{{ item.url }}">{{ item.data.title or 'Untitled' }}</a></h2>
{% if item.date %}
<time class="text-xs text-gray-500 dt-published" datetime="{{ item.date | htmlDateString }}">{{ item.date | readableDate }}</time>
{% endif %}
{% if item.data.description %}
<p class="mt-1 p-summary">{{ item.data.description }}</p>
{% endif %}
</article>
{% endfor %}
</section>
<nav class="mt-8 flex items-center justify-between" aria-label="Pagination">
{% if pagination.href.previous %}
<a class="px-4 py-2 rounded bg-gray-100 dark:bg-gray-800 hover:bg-gray-200" href="{{ pagination.href.previous }}">← Newer</a>
{% else %}
<span class="px-4 py-2 text-gray-400">← Newer</span>
{% endif %}
<span class="text-sm text-gray-600 dark:text-gray-400">Page {{ pagination.pageNumber + 1 }} of {{ pagination.pages | length }}</span>
{% if pagination.href.next %}
<a class="px-4 py-2 rounded bg-gray-100 dark:bg-gray-800 hover:bg-gray-200" href="{{ pagination.href.next }}">Older →</a>
{% else %}
<span class="px-4 py-2 text-gray-400">Older →</span>
{% endif %}
</nav>
{% endif %}