- {post.data.tags.map(item => (
+ {post.data.tags.map((item: string) => (
{item}
))}
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 783102b..91d327a 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -64,13 +64,13 @@ const latestBlogPost = await getCollection("posts")
) : null
}
- {latestBlogPost?.data.title}
+ {latestBlogPost?.data.title}
{latestBlogPost?.data.description}
{
latestBlogPost !== null && (
-
Read more
+
Read more
All articles
)
}
diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts
index d171cdc..8b4dbeb 100644
--- a/src/pages/rss.xml.ts
+++ b/src/pages/rss.xml.ts
@@ -11,8 +11,8 @@ export async function GET(context: { site: any; }) {
description: 'Something that\'s supposed to be thoughts.',
site: context.site,
items: posts.map((post) => ({
- link: `/blog/${post.slug}/`,
- content: sanitizeHtml(marked.parse(post.body), {
+ link: `/blog/${post.id}/`,
+ content: sanitizeHtml(marked.parse(post.body ?? ""), {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img'])
}),
pubDate: new Date(post.data.publishDate),
diff --git a/src/pages/writing/[slug].astro b/src/pages/writing/[slug].astro
index 34f69ea..ffacf00 100644
--- a/src/pages/writing/[slug].astro
+++ b/src/pages/writing/[slug].astro
@@ -1,5 +1,5 @@
---
-import {type CollectionEntry, getCollection} from "astro:content";
+import {type CollectionEntry, getCollection, render} from "astro:content";
import BaseLayout from "../../layouts/BaseLayout.astro";
export async function getStaticPaths() {
@@ -7,11 +7,11 @@ export async function getStaticPaths() {
const posts = await getCollection('writing');
return posts.map(p => ({
params: {
- slug: p.slug
+ slug: p.id
},
props: {
title: p.data.title,
- slug: p.slug,
+ slug: p.id,
},
}));
}
@@ -19,9 +19,9 @@ export async function getStaticPaths() {
const {slug, title} = Astro.props;
const permalink = `${Astro?.site?.href}writing/${slug}`;
const writing = await getCollection('writing');
-const entry: CollectionEntry<'writing'> | undefined = writing.find(e => e.slug === slug);
+const entry: CollectionEntry<'writing'> | undefined = writing.find(e => e.id === slug);
if (!entry) throw new Error(`Entry not found: ${slug}`);
-const { Content } = await entry.render();
+const { Content } = await render(entry);
---