chore: added markdown strip in rss fallback title
960b972f
1 file(s) · +10 −1
| 46 | 46 | return dateB - dateA; |
|
| 47 | 47 | }); |
|
| 48 | 48 | ||
| 49 | + | const stripMarkdown = (text: string) => |
|
| 50 | + | sanitizeHtml(md.renderInline(text), { |
|
| 51 | + | allowedTags: [], |
|
| 52 | + | allowedAttributes: {}, |
|
| 53 | + | }); |
|
| 54 | + | ||
| 49 | 55 | const items = posts.map((post) => { |
|
| 50 | - | const fallback = post.content ? `${post.content.slice(0, 70)}...` : post.slug; |
|
| 56 | + | const rawFallback = post.content |
|
| 57 | + | ? `${post.content.slice(0, 70)}...` |
|
| 58 | + | : post.slug; |
|
| 59 | + | const fallback = stripMarkdown(rawFallback); |
|
| 51 | 60 | const htmlContent = md.render(post.content || post.title || ""); |
|
| 52 | 61 | const description = post.meta_description || post.title || fallback; |
|
| 53 | 62 |