mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 19:41:02 +08:00
Update contents' path and and href for replaced contents
This commit is contained in:
@@ -16,7 +16,7 @@ export interface Frontmatter {
|
|||||||
tags: string[];
|
tags: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const posts = await Astro.glob<Frontmatter>("../pages/posts/*.md");
|
const posts = await Astro.glob<Frontmatter>("../contents/*.md");
|
||||||
|
|
||||||
const sortedPosts = getSortedPosts(posts);
|
const sortedPosts = getSortedPosts(posts);
|
||||||
---
|
---
|
||||||
@@ -89,11 +89,11 @@ const sortedPosts = getSortedPosts(posts);
|
|||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
posts.map(
|
posts.map(
|
||||||
(post) =>
|
({ frontmatter }) =>
|
||||||
post.frontmatter.featured && (
|
frontmatter.featured && (
|
||||||
<Card
|
<Card
|
||||||
href={post.url}
|
href={`/posts/${frontmatter.slug}`}
|
||||||
post={post.frontmatter}
|
post={frontmatter}
|
||||||
secHeading={false}
|
secHeading={false}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -107,11 +107,11 @@ const sortedPosts = getSortedPosts(posts);
|
|||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
sortedPosts.map(
|
sortedPosts.map(
|
||||||
(post, index) =>
|
({ frontmatter }, index) =>
|
||||||
index < 4 && (
|
index < 4 && (
|
||||||
<Card
|
<Card
|
||||||
href={post.url}
|
href={`/posts/${frontmatter.slug}`}
|
||||||
post={post.frontmatter}
|
post={frontmatter}
|
||||||
secHeading={false}
|
secHeading={false}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Card from "@components/Card.astro";
|
|||||||
import type { Frontmatter } from "../index.astro";
|
import type { Frontmatter } from "../index.astro";
|
||||||
import getSortedPosts from "src/utils/getSortedPosts";
|
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);
|
const sortedPosts = getSortedPosts(posts);
|
||||||
---
|
---
|
||||||
@@ -17,9 +17,11 @@ const sortedPosts = getSortedPosts(posts);
|
|||||||
<Main pageTitle="Posts" pageDesc="All the tags used in posts.">
|
<Main pageTitle="Posts" pageDesc="All the tags used in posts.">
|
||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
sortedPosts.map((post) => (
|
sortedPosts.map(({ frontmatter }) => {
|
||||||
<Card href={post.url} post={post.frontmatter} />
|
return (
|
||||||
))
|
<Card href={`/posts/${frontmatter.slug}`} post={frontmatter} />
|
||||||
|
);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</Main>
|
</Main>
|
||||||
|
|||||||
Reference in New Issue
Block a user