Change glob

This commit is contained in:
elpekenin
2022-10-16 12:17:36 +02:00
parent 4fbe54450e
commit a256dedb73
7 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -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);
--- ---
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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,
} }
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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);
--- ---