From 402c84dc673a7ca91ce6d2269a3dac20ae20173e Mon Sep 17 00:00:00 2001 From: "daniel.beskin" Date: Wed, 18 Feb 2026 12:18:20 +0200 Subject: [PATCH] Making the use of descriptions more consistent Fixing a discrepancy in the post description when rendering the post. It now uses `remarkPluginFrontmatter`'s output. The `remarkPluginFrontMatter` plugin already uses the post's own description, so there's no need to fallback in other places. The RSS feed is still inconsistent, see the TODO comment. --- src/components/PostPreview.astro | 2 +- src/pages/posts/[slug].astro | 5 +++-- src/pages/rss.xml.ts | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/PostPreview.astro b/src/components/PostPreview.astro index 358daf7b..273453a7 100644 --- a/src/components/PostPreview.astro +++ b/src/components/PostPreview.astro @@ -14,7 +14,7 @@ interface Props { const { post } = Astro.props const { remarkPluginFrontmatter } = await render(post) -const description = remarkPluginFrontmatter.description || post.data.description +const description = remarkPluginFrontmatter.description let tags: Collation<'posts'>[] | undefined if (post.data.tags && post.data.tags.length > 0) { const tagsGroup = await TagsGroup.build() diff --git a/src/pages/posts/[slug].astro b/src/pages/posts/[slug].astro index ea9b5635..faf7159f 100644 --- a/src/pages/posts/[slug].astro +++ b/src/pages/posts/[slug].astro @@ -31,7 +31,8 @@ export const getStaticPaths = (async () => { const { post, prev, next } = Astro.props const postData = post.data -const { headings, Content: PostContent } = await render(post) +const { headings, Content: PostContent, remarkPluginFrontmatter } = await render(post) +const description = remarkPluginFrontmatter.description const addendum = await getCollection('addendum') let AddendumContent let addendumAvatarImage @@ -68,7 +69,7 @@ if (postData.tags && postData.tags.length > 0) { diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 49f68c10..1d60138a 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -23,6 +23,8 @@ export async function GET(_context: AstroGlobal) { items: posts.map((post) => ({ title: post.data.title, pubDate: post.data.published, + // TODO this is not consistent with the `remarkDescription` plugin + // should we render the post here as well? description: post.data.description, author: post.data.author || siteConfig.author, link: `/posts/${post.id}`,