From 99c3ec115292c7220e00b20d4fae7e170524c712 Mon Sep 17 00:00:00 2001 From: Sat Naing Date: Sun, 11 Sep 2022 01:57:21 +0630 Subject: [PATCH] Update contents' path and and href for replaced contents --- src/pages/index.astro | 16 ++++++++-------- src/pages/posts/index.astro | 10 ++++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 8566720..5799874 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -16,7 +16,7 @@ export interface Frontmatter { tags: string[]; } -const posts = await Astro.glob("../pages/posts/*.md"); +const posts = await Astro.glob("../contents/*.md"); const sortedPosts = getSortedPosts(posts); --- @@ -89,11 +89,11 @@ const sortedPosts = getSortedPosts(posts);
    { posts.map( - (post) => - post.frontmatter.featured && ( + ({ frontmatter }) => + frontmatter.featured && ( ) @@ -107,11 +107,11 @@ const sortedPosts = getSortedPosts(posts);
      { sortedPosts.map( - (post, index) => + ({ frontmatter }, index) => index < 4 && ( ) diff --git a/src/pages/posts/index.astro b/src/pages/posts/index.astro index af379cf..d68feee 100644 --- a/src/pages/posts/index.astro +++ b/src/pages/posts/index.astro @@ -7,7 +7,7 @@ import Card from "@components/Card.astro"; import type { Frontmatter } from "../index.astro"; import getSortedPosts from "src/utils/getSortedPosts"; -const posts = await Astro.glob("./*.md"); +const posts = await Astro.glob("../../contents/*.md"); const sortedPosts = getSortedPosts(posts); --- @@ -17,9 +17,11 @@ const sortedPosts = getSortedPosts(posts);
        { - sortedPosts.map((post) => ( - - )) + sortedPosts.map(({ frontmatter }) => { + return ( + + ); + }) }