From 723be82ec70852b84017641d468e863bce89b286 Mon Sep 17 00:00:00 2001 From: MikuroXina Date: Fri, 30 Aug 2024 23:38:19 +0900 Subject: [PATCH] Update query in blog index --- src/pages/blog.tsx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/pages/blog.tsx b/src/pages/blog.tsx index cf0013ab..488d51c6 100644 --- a/src/pages/blog.tsx +++ b/src/pages/blog.tsx @@ -15,11 +15,10 @@ import { Layout } from "../components/layout"; import React from "react"; function BlogCard({ + slug, frontmatter, - parent, -}: Queries.BlogEntriesQuery["allMarkdownRemark"]["nodes"][number]): JSX.Element { +}: Queries.BlogEntriesQuery["allBlog"]["nodes"][number]): JSX.Element { const title = frontmatter?.title ?? "無題"; - const slug = (parent as { name?: string })?.name!; return ( @@ -46,32 +45,27 @@ function BlogCard({ export const query = graphql` query BlogEntries { - allMarkdownRemark(sort: { frontmatter: { date: ASC } }) { + allBlog { nodes { - id + slug frontmatter { title date author authorId } - parent { - ... on File { - name - } - } } } } `; export default function Blog({ data }: PageProps) { - const blogs = data.allMarkdownRemark.nodes; + const blogs = data.allBlog.nodes; return ( {blogs.map((blog) => ( - + ))}