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
This commit is contained in:
parent
a122e4e98a
commit
69ab0d34e0
1 changed files with 2 additions and 0 deletions
2
posts.go
2
posts.go
|
@ -1247,6 +1247,8 @@ func getSlug(title, lang string) string {
|
||||||
|
|
||||||
func getSlugFromPost(title, body, lang string) string {
|
func getSlugFromPost(title, body, lang string) string {
|
||||||
if title == "" {
|
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 = postTitle(body, body)
|
||||||
}
|
}
|
||||||
title = parse.PostLede(title, false)
|
title = parse.PostLede(title, false)
|
||||||
|
|
Loading…
Add table
Reference in a new issue