From 4da707eb49a8e41de2637b606376f6e5c4168e0f Mon Sep 17 00:00:00 2001 From: Simon Byford Date: Wed, 27 Nov 2024 09:45:13 +0000 Subject: [PATCH] Don't render empty bios --- dotcom-rendering/src/components/MiniProfile.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dotcom-rendering/src/components/MiniProfile.tsx b/dotcom-rendering/src/components/MiniProfile.tsx index fd3c64dee7..01890279bd 100644 --- a/dotcom-rendering/src/components/MiniProfile.tsx +++ b/dotcom-rendering/src/components/MiniProfile.tsx @@ -116,8 +116,11 @@ export const MiniProfile = ({ ); }; +const containsText = (html: string) => + html.replace(/<[^>]*>?/gm, '').length > 0; + const Bio = ({ html }: { html?: string }) => { - if (!html) return null; + if (!html || !containsText(html)) return null; const sanitizedHtml = sanitise(html, {}); return ( <>