refactor: update collection type and new schema property name

This commit is contained in:
satnaing
2023-01-28 01:18:25 +06:30
parent 1717222a8b
commit 38761e2e8f
2 changed files with 17 additions and 17 deletions
+6 -9
View File
@@ -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>