Skip to content

Commit

Permalink
Change glob
Browse files Browse the repository at this point in the history
  • Loading branch information
elpekenin committed Oct 16, 2022
1 parent 4fbe544 commit a256ded
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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);
---
Expand Down
4 changes: 2 additions & 2 deletions src/pages/posts/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/posts/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/rss.xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/pages/tags/[tag].astro
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tags/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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);
---
Expand Down

0 comments on commit a256ded

Please sign in to comment.