From fcc1e7119e82a64fd6df0950c9f1910e37c54096 Mon Sep 17 00:00:00 2001
From: Vittorio Alfieri
Date: Sat, 14 Mar 2026 18:56:08 -0500
Subject: [PATCH] Sanitize blog summaries with plainify and truncate
Raw .Summary can emit HTML tags into card previews and list pages,
breaking layout. Apply plainify | truncate to strip tags and limit
length: 150 chars for homepage recent posts, 300 for list pages.
Co-Authored-By: Claude Opus 4.6
---
layouts/_default/list.html | 2 +-
layouts/partials/recent_posts.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 1063747ea..c197c9a3c 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -67,7 +67,7 @@
{{ end }}
{{ if not .Site.Params.recent_posts.hide_summary }}
- {{ .Summary }}
+ {{ .Summary | plainify | truncate 300 }}
{{ i18n "continueReading" }}
{{ end }}
diff --git a/layouts/partials/recent_posts.html b/layouts/partials/recent_posts.html
index e7551e1a8..49f0f7cf3 100644
--- a/layouts/partials/recent_posts.html
+++ b/layouts/partials/recent_posts.html
@@ -50,7 +50,7 @@
{{ end }}
{{ if not .Site.Params.recent_posts.hide_summary }}
- {{ .Summary }}
+ {{ .Summary | plainify | truncate 150 }}
{{ i18n "continueReading" }}