main
 1---
 2import { getCollection, render } from "astro:content";
 3import type { GetStaticPaths, InferGetStaticPropsType } from "astro";
 4import GlobalLayout from "@/layouts/GlobalLayout.astro";
 5import { url } from "@/utils/url";
 6
 7type Props = InferGetStaticPropsType<typeof getStaticPaths>;
 8
 9export const getStaticPaths = (async () => {
10  const entries = await getCollection("posts");
11  return entries.map((entry) => ({
12    params: {
13      slug: entry.id,
14    },
15    props: { entry },
16  }));
17}) satisfies GetStaticPaths;
18
19const { entry } = Astro.props;
20const data = entry.data;
21const { Content } = await render(entry);
22---
23
24<GlobalLayout
25  title={data.title}
26  author={data.author}
27  description={data.desc}
28  isArticle={true}
29>
30  <article>
31    <Content />
32  </article>
33  <footer class="mt-8 article-anchor text-base lg:text-lg">
34    <a href={url(`posts/${entry.id}/archive.pdf`)}>
35      <span>PDF archive of this post</span>
36    </a>
37  </footer>
38</GlobalLayout>