From e847e626b13ff4e8ca5c04ab303c7ff45ee64656 Mon Sep 17 00:00:00 2001 From: Ferdinand Malcher Date: Mon, 18 Nov 2024 14:00:27 +0100 Subject: [PATCH] strip link tags from preview paragraph --- build/utils.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build/utils.ts b/build/utils.ts index 8c1be22..ad1b1e4 100644 --- a/build/utils.ts +++ b/build/utils.ts @@ -14,13 +14,11 @@ export function extractFirstBigParagraph(html: string): string { return ''; } - for (const match of matches) { - if (match && match.length > 100) { - return match; - } - } + const paragraph = matches.find(m => m && m.length > 100) || ''; + // strip anchor tags but retain link text + const result = paragraph.replace(/(.*?)<\/a>/g, '$1'); - return ''; + return result; } export function makeLightBlogList(fullList: BlogEntry[]): BlogEntryLight[] {