Skip to content

Commit

Permalink
🎨 update import posts
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed Jan 21, 2025
1 parent 2a5a579 commit bf9aae8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion .astro/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />
2 changes: 1 addition & 1 deletion src/components/LeftSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AstroLogo from "./Header/AstroLogo.astro";
import { SITE } from "@/config";
import { parseTitle, sortPosts } from "@/util";
const posts = await Astro.glob("../pages/posts/*.md");
const posts = Object.values(import.meta.glob('../pages/posts/*.md', { eager: true }));
const allPosts = sortPosts(posts);
let currentPageMatch = currentPage.slice(1).replace(/\/$/, "");
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/post.astro
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const content = {
const currentUrl = `${SITE.homePage}${currentPage}`;
// The next article
const posts = await Astro.glob("../pages/posts/*.md");
const posts = Object.values(import.meta.glob('../pages/posts/*.md', { eager: true }));
const allPosts = sortPosts(posts);
const postIndex = getIndex(currentPage);
let nextUrl =
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Footer from "../components/Footer.astro";
import { SITE } from "@/config";
import { sortPosts } from "@/util";
const posts = await Astro.glob("./posts/*.md");
const posts = Object.values(import.meta.glob('./posts/*.md', { eager: true }));
const allPosts = sortPosts(posts);
---

Expand Down

0 comments on commit bf9aae8

Please sign in to comment.