mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor: update collection type and new schema property name
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import { SITE } from "src/config";
|
||||
import { SITE } from "@config";
|
||||
import Layout from "@layouts/Layout.astro";
|
||||
import Main from "@layouts/Main.astro";
|
||||
import Header from "@components/Header.astro";
|
||||
@@ -7,13 +7,12 @@ import Footer from "@components/Footer.astro";
|
||||
import Card from "@components/Card";
|
||||
import LinkButton from "@components/LinkButton.astro";
|
||||
import slugify from "@utils/slugify";
|
||||
import type { MarkdownInstance } from "astro";
|
||||
import type { Frontmatter } from "src/types";
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
|
||||
export interface Props {
|
||||
pageNum: number;
|
||||
totalPages: number;
|
||||
posts: MarkdownInstance<Frontmatter>[];
|
||||
posts: CollectionEntry<"blog">[];
|
||||
}
|
||||
|
||||
const { pageNum, totalPages, posts } = Astro.props;
|
||||
@@ -27,11 +26,9 @@ const next = pageNum < totalPages ? "" : "disabled";
|
||||
<Main pageTitle="Posts" pageDesc="All the articles I've posted.">
|
||||
<ul>
|
||||
{
|
||||
posts.map(({ frontmatter }) => {
|
||||
return (
|
||||
<Card href={`/posts/${slugify(frontmatter)}`} post={frontmatter} />
|
||||
);
|
||||
})
|
||||
posts.map(({ data }) => (
|
||||
<Card href={`/posts/${slugify(data)}`} frontmatter={data} />
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</Main>
|
||||
|
||||
Reference in New Issue
Block a user