feat(upgrade): 迁移到 Astro V6

This commit is contained in:
Ad-closeNN
2026-04-19 22:12:00 +08:00
parent a96c270bfe
commit 27a6f94f64
11 changed files with 2940 additions and 3437 deletions
+8 -5
View File
@@ -1,5 +1,6 @@
---
import path from "node:path";
import { render, type CollectionEntry } from "astro:content";
import License from "@components/misc/License.astro";
import Markdown from "@components/misc/Markdown.astro";
import I18nKey from "@i18n/i18nKey";
@@ -17,15 +18,17 @@ import { formatDateToYYYYMMDD } from "../../utils/date-utils";
export async function getStaticPaths() {
const blogEntries = await getSortedPosts();
return blogEntries.map((entry) => ({
params: { slug: entry.slug },
params: { slug: entry.id },
props: { entry },
}));
}
const { entry } = Astro.props;
const { Content, headings } = await entry.render();
interface Props {
entry: CollectionEntry<"posts">;
}
const { remarkPluginFrontmatter } = await entry.render();
const { entry }: Props = Astro.props;
const { Content, headings, remarkPluginFrontmatter } = await render(entry);
const jsonLd = {
"@context": "https://schema.org",
@@ -134,7 +137,7 @@ const customcover = entry.data.customcover;
<Content />
</Markdown>
{licenseConfig.enable && <License title={entry.data.title} slug={entry.slug} pubDate={entry.data.published} class="mb-6 rounded-xl license-container onload-animation"></License>}
{licenseConfig.enable && <License title={entry.data.title} slug={entry.id} pubDate={entry.data.published} class="mb-6 rounded-xl license-container onload-animation"></License>}
</div>
</div>