Skip to content

Commit 2696f21

Browse files
committed
fix: Enhance contentSnippet processing in Feed component
- Updated the contentSnippet extraction to strip HTML tags, remove non-breaking spaces, and trim whitespace for cleaner output. - Improved the overall readability of post descriptions in the Feed component.
1 parent 12ecaf6 commit 2696f21

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

components/feed.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ const Feed = () => {
3232
link: post.querySelector("link")?.textContent,
3333
guid: post.querySelector("guid")?.textContent,
3434
pubDate: post.querySelector("pubDate")?.textContent,
35-
contentSnippet: post.querySelector("description")?.textContent?.replace(/<[^>]*>/g, ''), // Strip HTML
35+
contentSnippet: post.querySelector("description")
36+
?.textContent
37+
?.replace(/<[^>]*>/g, '') // strip HTML
38+
?.replace(/&#160;/g, '') // strip out &#160;
39+
?.trim(),
3640
image: post.querySelector("content")?.getAttribute("url")
3741
}))
3842

0 commit comments

Comments
 (0)