Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for Astro v5.0 #32

Draft
wants to merge 1 commit into
base: complete
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import BaseLayout from "../layouts/BaseLayout.astro";
import BlogPost from "../components/BlogPost.astro";
const pageTitle = "My Astro Learning Blog";
const allPosts = await Astro.glob("../pages/posts/*.md");
const allPosts = Object.values(await import.meta.glob('./posts/*.md', { eager: true }));
---

<BaseLayout pageTitle={pageTitle}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/posts/post-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ image:
pubDate: 2022-08-08
tags: ["astro", "successes"]
---
This post should show up with my other blog posts, because `Astro.glob()` is returning a list of all my posts in order to create my list.
This post should show up with my other blog posts, because `import.meta.glob()` is returning a list of all my posts in order to create my list.
2 changes: 1 addition & 1 deletion src/pages/tags/[tag].astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BaseLayout from "../../layouts/BaseLayout.astro";
import BlogPost from "../../components/BlogPost.astro";

export async function getStaticPaths() {
const allPosts = await Astro.glob("../posts/*.md");
const allPosts = Object.values(await import.meta.glob('./posts/*.md', { eager: true }));

const uniqueTags = [
...new Set(allPosts.map((post) => post.frontmatter.tags).flat()),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/tags/index.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import BaseLayout from "../../layouts/BaseLayout.astro";
const allPosts = await Astro.glob("../posts/*.md");
const allPosts = Object.values(await import.meta.glob('./posts/*.md', { eager: true }));
const tags = [...new Set(allPosts.map((post) => post.frontmatter.tags).flat())];
const pageTitle = "Tag Index";
---
Expand Down