diff options
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/blog/[...slug].astro | 4 | ||||
| -rw-r--r-- | src/pages/blog/index.astro | 2 | ||||
| -rw-r--r-- | src/pages/blog/tags/[tag].astro | 2 | ||||
| -rw-r--r-- | src/pages/index.astro | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 5f1b34a..6dc78ba 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -1,6 +1,6 @@ --- import Page from '../../layouts/BlogPost.astro'; -import { getEntry } from 'astro:content'; +import { getEntry, render } from 'astro:content'; import { formatDate } from "../../util"; const { slug } = Astro.params; @@ -14,7 +14,7 @@ if(entry === undefined) { return Astro.redirect('/404'); } -const { Content } = await entry.render(); +const { Content } = await render(entry); --- <Page title={entry.data.title} description={entry.data.description} pubDate={formatDate(entry.data.pubDate)} tags={entry.data.tags}> <main> diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index a35537a..0e4e25e 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -23,7 +23,7 @@ const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.pubDate <div class="grid"> {allBlogPosts.map((post) => ( <article class="card"> - <h1><a href={`/blog/${post.slug}`}>{post.data.title}</a></h1> + <h1><a href={`/blog/${post.id}`}>{post.data.title}</a></h1> <small>{formatDate(post.data.pubDate)}</small> <p>{post.data.description}</p> <div class="tags"> diff --git a/src/pages/blog/tags/[tag].astro b/src/pages/blog/tags/[tag].astro index 01bd03a..b0b0ccb 100644 --- a/src/pages/blog/tags/[tag].astro +++ b/src/pages/blog/tags/[tag].astro @@ -4,7 +4,7 @@ import {formatDate} from "../../../util"; import "../../../styles/cards.css"; export const prerender = true; export async function getStaticPaths() { - const allPosts = await Astro.glob('../../../content/blog/**/*.md'); + const allPosts = Object.values(import.meta.glob('../../../content/blog/**/*.md', { eager: true })); let uniqueTags = []; if (allPosts) { diff --git a/src/pages/index.astro b/src/pages/index.astro index f1c2da9..943dc01 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -100,7 +100,7 @@ const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.pubDate <h1>Latest Posts</h1> {allBlogPosts.map((post) => ( <article> - <h1 class="blog-title"><a href={`/blog/${post.slug}`}>{post.data.title}</a></h1> + <h1 class="blog-title"><a href={`/blog/${post.id}`}>{post.data.title}</a></h1> <small>{formatDate(post.data.pubDate)}</small> <p>{post.data.description}</p> </article> |
