mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
build!: upgrade Astro to v5 and related packages
This commit is contained in:
@@ -69,8 +69,8 @@ const MonthMap: Record<string, string> = {
|
||||
new Date(a.data.pubDatetime).getTime() / 1000
|
||||
)
|
||||
)
|
||||
.map(({ data, slug }) => (
|
||||
<Card href={`/posts/${slug}`} frontmatter={data} />
|
||||
.map(({ data, id }) => (
|
||||
<Card href={`/posts/${id}`} frontmatter={data} />
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -75,9 +75,9 @@ const socialCount = SOCIALS.filter(social => social.active).length;
|
||||
<section id="featured">
|
||||
<h2>Featured</h2>
|
||||
<ul>
|
||||
{featuredPosts.map(({ data, slug }) => (
|
||||
{featuredPosts.map(({ data, id }) => (
|
||||
<Card
|
||||
href={`/posts/${slug}/`}
|
||||
href={`/posts/${id}/`}
|
||||
frontmatter={data}
|
||||
secHeading={false}
|
||||
/>
|
||||
@@ -95,10 +95,10 @@ const socialCount = SOCIALS.filter(social => social.active).length;
|
||||
<h2>Recent Posts</h2>
|
||||
<ul>
|
||||
{recentPosts.map(
|
||||
({ data, slug }, index) =>
|
||||
({ data, id }, index) =>
|
||||
index < SITE.postPerIndex && (
|
||||
<Card
|
||||
href={`/posts/${slug}/`}
|
||||
href={`/posts/${id}/`}
|
||||
frontmatter={data}
|
||||
secHeading={false}
|
||||
/>
|
||||
|
||||
@@ -11,7 +11,7 @@ export async function getStaticPaths() {
|
||||
const posts = await getCollection("blog", ({ data }) => !data.draft);
|
||||
|
||||
const postResult = posts.map(post => ({
|
||||
params: { slug: post.slug },
|
||||
params: { slug: post.id },
|
||||
props: { post },
|
||||
}));
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ export async function GET() {
|
||||
title: SITE.title,
|
||||
description: SITE.desc,
|
||||
site: SITE.website,
|
||||
items: sortedPosts.map(({ data, slug }) => ({
|
||||
link: `posts/${slug}/`,
|
||||
items: sortedPosts.map(({ data, id }) => ({
|
||||
link: `posts/${id}/`,
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
pubDate: new Date(data.modDatetime ?? data.pubDatetime),
|
||||
|
||||
@@ -13,11 +13,11 @@ const posts = await getCollection("blog", ({ data }) => !data.draft);
|
||||
const sortedPosts = getSortedPosts(posts);
|
||||
|
||||
// List of items to search in
|
||||
const searchList = sortedPosts.map(({ data, slug }) => ({
|
||||
const searchList = sortedPosts.map(({ data, id }) => ({
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
data,
|
||||
slug,
|
||||
slug: id,
|
||||
}));
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user