mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
@@ -10,7 +10,7 @@ import slugify from "@utils/slugify";
|
|||||||
import type { Frontmatter } from "src/types";
|
import type { Frontmatter } from "src/types";
|
||||||
import Socials from "@components/Socials.astro";
|
import Socials from "@components/Socials.astro";
|
||||||
|
|
||||||
const posts = await Astro.glob<Frontmatter>("../contents/*.md");
|
const posts = await Astro.glob<Frontmatter>("../contents/**/*.md");
|
||||||
|
|
||||||
const sortedPosts = getSortedPosts(posts);
|
const sortedPosts = getSortedPosts(posts);
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type PagePaths = {
|
|||||||
}[];
|
}[];
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await Astro.glob<Frontmatter>("../../contents/*.md");
|
const posts = await Astro.glob<Frontmatter>("../../contents/**/*.md");
|
||||||
|
|
||||||
let postResult: PostResult = posts.map((post) => {
|
let postResult: PostResult = posts.map((post) => {
|
||||||
return {
|
return {
|
||||||
@@ -51,7 +51,7 @@ export async function getStaticPaths() {
|
|||||||
const { slug } = Astro.params;
|
const { slug } = Astro.params;
|
||||||
const { post } = Astro.props;
|
const { post } = Astro.props;
|
||||||
|
|
||||||
const posts = await Astro.glob<Frontmatter>("../../contents/*.md");
|
const posts = await Astro.glob<Frontmatter>("../../contents/**/*.md");
|
||||||
|
|
||||||
const sortedPosts = getSortedPosts(posts);
|
const sortedPosts = getSortedPosts(posts);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import getSortedPosts from "@utils/getSortedPosts";
|
|||||||
import getPageNumbers from "@utils/getPageNumbers";
|
import getPageNumbers from "@utils/getPageNumbers";
|
||||||
import type { Frontmatter } from "src/types";
|
import type { Frontmatter } from "src/types";
|
||||||
|
|
||||||
const posts = await Astro.glob<Frontmatter>("../../contents/*.md");
|
const posts = await Astro.glob<Frontmatter>("../../contents/**/*.md");
|
||||||
|
|
||||||
const sortedPosts = getSortedPosts(posts);
|
const sortedPosts = getSortedPosts(posts);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { MarkdownInstance } from "astro";
|
|||||||
import slugify from "@utils/slugify";
|
import slugify from "@utils/slugify";
|
||||||
|
|
||||||
const postImportResult = import.meta.glob<MarkdownInstance<Frontmatter>>(
|
const postImportResult = import.meta.glob<MarkdownInstance<Frontmatter>>(
|
||||||
"../contents/*.md",
|
"../contents/**/**/*.md",
|
||||||
{
|
{
|
||||||
eager: true,
|
eager: true,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Search from "@components/Search";
|
|||||||
import type { Frontmatter } from "src/types";
|
import type { Frontmatter } from "src/types";
|
||||||
|
|
||||||
// Retrieve all articles
|
// Retrieve all articles
|
||||||
const posts = await Astro.glob<Frontmatter>("../contents/*.md");
|
const posts = await Astro.glob<Frontmatter>("../contents/**/*.md");
|
||||||
|
|
||||||
// List of items to search in
|
// List of items to search in
|
||||||
const searchList = posts
|
const searchList = posts
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export interface Props {
|
|||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts: MarkdownInstance<Frontmatter>[] = await Astro.glob(
|
const posts: MarkdownInstance<Frontmatter>[] = await Astro.glob(
|
||||||
"../../contents/*.md"
|
"../../contents/**/*.md"
|
||||||
);
|
);
|
||||||
|
|
||||||
const tags = getUniqueTags(posts);
|
const tags = getUniqueTags(posts);
|
||||||
@@ -38,7 +38,7 @@ export async function getStaticPaths() {
|
|||||||
const { tag } = Astro.props;
|
const { tag } = Astro.props;
|
||||||
|
|
||||||
const posts: MarkdownInstance<Frontmatter>[] = await Astro.glob(
|
const posts: MarkdownInstance<Frontmatter>[] = await Astro.glob(
|
||||||
"../../contents/*.md"
|
"../../contents/**/*.md"
|
||||||
);
|
);
|
||||||
|
|
||||||
const tagPosts = getPostsByTag(posts, tag);
|
const tagPosts = getPostsByTag(posts, tag);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import Tag from "@components/Tag.astro";
|
|||||||
import getUniqueTags from "@utils/getUniqueTags";
|
import getUniqueTags from "@utils/getUniqueTags";
|
||||||
import type { Frontmatter } from "src/types";
|
import type { Frontmatter } from "src/types";
|
||||||
|
|
||||||
const posts = await Astro.glob<Frontmatter>("../../contents/*.md");
|
const posts = await Astro.glob<Frontmatter>("../../contents/**/*.md");
|
||||||
|
|
||||||
let tags = getUniqueTags(posts);
|
let tags = getUniqueTags(posts);
|
||||||
---
|
---
|
||||||
|
|||||||
Reference in New Issue
Block a user