From 91ff6e28dfac408cf07cbca222af54180f36c625 Mon Sep 17 00:00:00 2001 From: Qiang Huang Date: Fri, 13 Feb 2026 00:00:58 -0800 Subject: [PATCH] fix(route/smartlink): Remove HTML from the title for cnbc (#21130) --- lib/routes/smartlink/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/routes/smartlink/index.ts b/lib/routes/smartlink/index.ts index 61cf7c039..e0d04bebb 100644 --- a/lib/routes/smartlink/index.ts +++ b/lib/routes/smartlink/index.ts @@ -12,7 +12,10 @@ function parseTitle(smartlinkUrl: string): string { const dateIndex = pathSegments.findIndex((segment) => dateRegex.test(segment)); // Use the segment after the date if found, otherwise use the last path segment - const titleSlug = dateIndex !== -1 && dateIndex < pathSegments.length - 1 ? pathSegments[dateIndex + 1] : pathSegments.at(-1) || ''; + let titleSlug = dateIndex !== -1 && dateIndex < pathSegments.length - 1 ? pathSegments[dateIndex + 1] : pathSegments.at(-1) || ''; + + // Remove .html/.htm extension if present + titleSlug = titleSlug.replace(/\.(html?|htm)$/i, ''); // Convert hyphens to spaces and capitalize each word return toTitleCase(titleSlug.replaceAll('-', ' '));