mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor: update fetch method and frontmatter type
This commit is contained in:
@@ -3,9 +3,10 @@ import { SITE } from "src/config";
|
|||||||
import Posts from "@layouts/Posts.astro";
|
import Posts from "@layouts/Posts.astro";
|
||||||
import getSortedPosts from "@utils/getSortedPosts";
|
import getSortedPosts from "@utils/getSortedPosts";
|
||||||
import getPageNumbers from "@utils/getPageNumbers";
|
import getPageNumbers from "@utils/getPageNumbers";
|
||||||
import type { Frontmatter } from "src/types";
|
|
||||||
|
|
||||||
const posts = await Astro.glob<Frontmatter>("../../contents/**/*.md");
|
import { getCollection } from "astro:content";
|
||||||
|
|
||||||
|
const posts = await getCollection("blog");
|
||||||
|
|
||||||
const sortedPosts = getSortedPosts(posts);
|
const sortedPosts = getSortedPosts(posts);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user