sundays/src/pages/notes/[...id].astro

71 lines
2.4 KiB
Text
Raw Normal View History

2026-06-05 14:31:12 -06:00
---
import Layout from '../../layouts/Layout.astro';
import { getCollection, getEntry, render } from 'astro:content';
import { type CollectionEntry } from 'astro:content';
import { dateFormat } from '../../utils/date';
import { urlfrag } from '../../utils/path';
import { titleCase } from '../../utils/strings';
interface Props {
note: CollectionEntry<'notes'>;
}
export async function getStaticPaths() {
const notes = await getCollection('notes');
return notes.map((note: CollectionEntry<'notes'>) => ({
2026-07-07 15:33:28 -06:00
params: { id: note.id.replace(/-/, '/') },
2026-06-05 14:31:12 -06:00
props: { note },
}));
}
const base = import.meta.env.BASE_URL;
const { note } = Astro.props;
const { Content } = await render(note);
const meta = `{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "${note.data.title}",
"image": "${urlfrag(base, note.data.post_image)}",
2026-06-05 14:31:12 -06:00
"author": {"@type": "Person", "name": "Benjamin A. Shelton"},
"publisher": {"@type": "Organization", "name": "Just Us"},
"datePublished": "${note.data.date.toISOString()}",
"dateModified": "${note.data.date.toISOString()}"
2026-06-05 14:31:12 -06:00
}`;
---
2026-06-30 15:14:04 -06:00
<Layout title=`${note.data.title} - ${note.data.sub_heading}`>
2026-06-05 14:31:12 -06:00
{meta && <script type="application/ld+json" is:inline set:html={meta} />}
2026-07-29 22:55:24 -06:00
<script type="module" src="/src/utils/modal.js"></script>
<script>
import { bindModals } from '../../utils/modal.js';
bindModals();
</script>
2026-06-05 14:31:12 -06:00
<article class="mx-auto p-4 lg:p-0 lg:max-w-6xl xl:p-0 xl:max-w-6xl 2xl:p-0 2xl:max-w-6xl" id="notes-page">
<div class="header">
<hgroup>
<h1 id="title">{note.data.title}</h1>
<h2 id="subtitle">{note.data.sub_heading}</h2>
</hgroup>
<section id="meta">
<time>{dateFormat(note.data.date)}</time>
<span class="divider">
<ul class="tags">
{note.data.tags?.filter((tag: string) => (tag != 'notes')).map((tag: string) => (
<li>{titleCase(tag)}</li>
))}</ul>
</section>
2026-06-05 14:31:12 -06:00
</div>
<div id="content" class="p-6">
<Content />
</div>
2026-07-29 22:55:24 -06:00
<dialog data-scripture=""
2026-08-06 13:41:16 -06:00
class="p-0 bg-white rounded-sm w-full max-w-md m-auto flex-col flex hidden scripture">
2026-07-30 16:17:31 -06:00
<div tabindex="-1" autofocus class="p-4">
2026-07-31 16:44:46 -06:00
<article>
</article>
2026-07-30 16:17:31 -06:00
</div>
2026-07-31 16:44:46 -06:00
</dialog>
2026-06-05 14:31:12 -06:00
</article>
</Layout>