Styling still needs tweaking and the Bible Gateway link needs to be fixed.
86 lines
No EOL
3.6 KiB
Text
86 lines
No EOL
3.6 KiB
Text
---
|
|
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.replace(/-/, '/') },
|
|
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"},
|
|
"datePublished": "${note.data.date.toISOString()}",
|
|
"dateModified": "${note.data.date.toISOString()}"
|
|
}`;
|
|
|
|
---
|
|
|
|
<Layout title=`${note.data.title} - ${note.data.sub_heading}`>
|
|
{meta && <script type="application/ld+json" is:inline set:html={meta} />}
|
|
<script type="module" src="/src/utils/modal.js"></script>
|
|
<script>
|
|
import { bindModals } from '../../utils/modal.js';
|
|
bindModals();
|
|
</script>
|
|
<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>
|
|
</div>
|
|
<div id="content" class="p-6">
|
|
<Content />
|
|
</div>
|
|
<dialog data-scripture=""
|
|
class="p-0 bg-white rounded-sm w-full max-w-md m-auto flex-col flex hidden scripture">
|
|
<div tabindex="-1" autofocus class="p-4">
|
|
<button data-close="">
|
|
<span class="align-middle">close</span>
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle inline" viewBox="0 0 16 16">
|
|
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
|
|
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
|
|
</svg>
|
|
</button>
|
|
<article class="mt-6">
|
|
</article>
|
|
<nav>
|
|
<a href="#">
|
|
Open on Bible Gateway
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link inline" viewBox="0 0 16 16">
|
|
<path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9q-.13 0-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/>
|
|
<path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4 4 0 0 1-.82 1H12a3 3 0 1 0 0-6z"/>
|
|
</svg></a>
|
|
</nav>
|
|
</div>
|
|
</dialog>
|
|
</article>
|
|
</Layout> |