Update contents' path and and href for replaced contents

This commit is contained in:
Sat Naing
2022-09-11 01:57:21 +06:30
parent b4089f2d1d
commit 99c3ec1152
2 changed files with 14 additions and 12 deletions
+8 -8
View File
@@ -16,7 +16,7 @@ export interface Frontmatter {
tags: string[];
}
const posts = await Astro.glob<Frontmatter>("../pages/posts/*.md");
const posts = await Astro.glob<Frontmatter>("../contents/*.md");
const sortedPosts = getSortedPosts(posts);
---
@@ -89,11 +89,11 @@ const sortedPosts = getSortedPosts(posts);
<ul>
{
posts.map(
(post) =>
post.frontmatter.featured && (
({ frontmatter }) =>
frontmatter.featured && (
<Card
href={post.url}
post={post.frontmatter}
href={`/posts/${frontmatter.slug}`}
post={frontmatter}
secHeading={false}
/>
)
@@ -107,11 +107,11 @@ const sortedPosts = getSortedPosts(posts);
<ul>
{
sortedPosts.map(
(post, index) =>
({ frontmatter }, index) =>
index < 4 && (
<Card
href={post.url}
post={post.frontmatter}
href={`/posts/${frontmatter.slug}`}
post={frontmatter}
secHeading={false}
/>
)
+6 -4
View File
@@ -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<Frontmatter>("./*.md");
const posts = await Astro.glob<Frontmatter>("../../contents/*.md");
const sortedPosts = getSortedPosts(posts);
---
@@ -17,9 +17,11 @@ const sortedPosts = getSortedPosts(posts);
<Main pageTitle="Posts" pageDesc="All the tags used in posts.">
<ul>
{
sortedPosts.map((post) => (
<Card href={post.url} post={post.frontmatter} />
))
sortedPosts.map(({ frontmatter }) => {
return (
<Card href={`/posts/${frontmatter.slug}`} post={frontmatter} />
);
})
}
</ul>
</Main>