Adding Astrojs sources.

This commit is contained in:
Benjamin A. Shelton 2026-06-05 14:31:12 -06:00
commit e20f4f45de
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01
169 changed files with 11389 additions and 0 deletions

View file

@ -0,0 +1,60 @@
---
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'>) => ({
params: { id: note.id },
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)},
"author": {"@type": "Person", "name": "Benjamin A. Shelton"},
"publisher": {"@type": "Organization", "name": "Just Us"},
"logo": {"@type": "ImageObject", "url": ${urlfrag(base, "favicon.png")}},
"datePublished": ${note.data.date},
"dateModified": ${note.data.date}
}`;
---
<Layout>
{meta && <script type="application/ld+json" is:inline set:html={meta} />}
<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:list={[`bg-[url(${urlfrag(base, note.data.post_image)})]`, 'bg-gray-100 rounded-md p-6']}>
<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>
</div>
<div id="content" class="p-6">
<Content />
</div>
</article>
</Layout>