diff --git a/src/pages/authors/[slug].astro b/src/pages/authors/[slug].astro new file mode 100644 index 0000000..bfba49e --- /dev/null +++ b/src/pages/authors/[slug].astro @@ -0,0 +1,35 @@ +--- +import type { GetStaticPaths } from "astro"; +import type { CollectionEntry } from "astro:content"; +import { getCollection } from "astro:content"; + +import NobbzDev from "../../layouts/NobbzDev.astro"; + +const components = {}; + +export const getStaticPaths = (async () => { + const authorEntries = await getCollection("authors"); + + return authorEntries.map((author) => ({ + params: { + slug: author.slug, + }, + props: { author }, + })); +}) satisfies GetStaticPaths; + +export type Props = { + author: CollectionEntry<"authors">; +}; + +const { author } = Astro.props; +const { Content } = await author.render(); +--- + + +
+

{author.data.nick_name}

+ + +
+
diff --git a/src/scripts/paths.ts b/src/scripts/paths.ts index fe96f5b..13b64fd 100644 --- a/src/scripts/paths.ts +++ b/src/scripts/paths.ts @@ -12,5 +12,5 @@ export const postPath = (post: CollectionEntry<"blog">): string => { export const authorPath = (author: CollectionEntry<"authors">): string => { const slug = author.slug; - return `/author/${slug}`; + return `/authors/${slug}`; };