Upgrade dependencies.
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import type {
|
||||
CollectionEntry,
|
||||
CollectionKey,
|
||||
ContentEntryMap,
|
||||
} from "astro:content";
|
||||
import type { CollectionEntry, CollectionKey } from "astro:content";
|
||||
import Footer from "../../../components/Footer.astro";
|
||||
import Nav from "../../../components/Nav.astro";
|
||||
import ArticleBodyWrapper from "../../../components/article/article_body/ArticleBodyWrapper.astro";
|
||||
@@ -13,22 +9,23 @@ import DefaultLayout from "../../../layouts/DefaultLayout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const collectionName: CollectionKey = "blog";
|
||||
const blogEntries = await getCollection(collectionName);
|
||||
return blogEntries.map((entry) => ({
|
||||
params: { blog: entry.slug },
|
||||
props: { entry },
|
||||
return blogEntries.map((post: CollectionEntry<CollectionKey>) => ({
|
||||
// Hide .md extension from URL
|
||||
params: { blog: post.id.replace(".md", "") },
|
||||
props: { post },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entry: CollectionEntry<keyof ContentEntryMap>;
|
||||
post: CollectionEntry<CollectionKey>;
|
||||
}
|
||||
const { entry } = Astro.props;
|
||||
const { post } = Astro.props;
|
||||
|
||||
const articlePrettyName: string = entry.id.split("/").pop()!.replace(".md", "");
|
||||
const articlePrettyName: string = post.data.title;
|
||||
---
|
||||
|
||||
<DefaultLayout title=`${articlePrettyName} - 李守中`>
|
||||
<Nav />
|
||||
<ArticleBodyWrapper collectionName="blog" articleSlug={entry.slug} />
|
||||
<ArticleBodyWrapper collectionName="blog" articleId={post.id} />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
||||
Reference in New Issue
Block a user