From 69ab0d34e03f4cb861962d4b2067e1ae87bc50fc Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Tue, 21 Dec 2021 13:55:10 -0500 Subject: [PATCH] Elide Markdown when generating slug This makes sure e.g. link URLs and image alt text don't get included in the slug. Ref T329 --- posts.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/posts.go b/posts.go index dd824a9..ed3f5e4 100644 --- a/posts.go +++ b/posts.go @@ -1247,6 +1247,8 @@ func getSlug(title, lang string) string { func getSlugFromPost(title, body, lang string) string { if title == "" { + // Remove Markdown, so e.g. link URLs and image alt text don't make it into the slug + body = strings.TrimSpace(stripmd.StripOptions(body, stripmd.Options{SkipImages: true})) title = postTitle(body, body) } title = parse.PostLede(title, false)