Merge pull request #3 from elpekenin/glob

Change glob
This commit is contained in:
Sat Naing
2022-10-16 17:48:00 +06:30
committed by GitHub
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 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);
---
+2 -2
View File
@@ -28,7 +28,7 @@ type PagePaths = {
}[];
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) => {
return {
@@ -51,7 +51,7 @@ export async function getStaticPaths() {
const { slug } = Astro.params;
const { post } = Astro.props;
const posts = await Astro.glob<Frontmatter>("../../contents/*.md");
const posts = await Astro.glob<Frontmatter>("../../contents/**/*.md");
const sortedPosts = getSortedPosts(posts);
+1 -1
View File
@@ -5,7 +5,7 @@ import getSortedPosts from "@utils/getSortedPosts";
import getPageNumbers from "@utils/getPageNumbers";
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);
+1 -1
View File
@@ -5,7 +5,7 @@ import type { MarkdownInstance } from "astro";
import slugify from "@utils/slugify";
const postImportResult = import.meta.glob<MarkdownInstance<Frontmatter>>(
"../contents/*.md",
"../contents/**/**/*.md",
{
eager: true,
}
+1 -1
View File
@@ -8,7 +8,7 @@ import Search from "@components/Search";
import type { Frontmatter } from "src/types";
// 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
const searchList = posts
+2 -2
View File
@@ -18,7 +18,7 @@ export interface Props {
export async function getStaticPaths() {
const posts: MarkdownInstance<Frontmatter>[] = await Astro.glob(
"../../contents/*.md"
"../../contents/**/*.md"
);
const tags = getUniqueTags(posts);
@@ -38,7 +38,7 @@ export async function getStaticPaths() {
const { tag } = Astro.props;
const posts: MarkdownInstance<Frontmatter>[] = await Astro.glob(
"../../contents/*.md"
"../../contents/**/*.md"
);
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 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);
---