Remove duplicate title inside the body

This commit is contained in:
dtonon
2024-05-30 22:37:35 +02:00
parent 261e1b8b38
commit 33b25e3271

View File

@@ -125,6 +125,7 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
for _, tag := range data.event.Tags { for _, tag := range data.event.Tags {
if tag[0] == "subject" || tag[0] == "title" { if tag[0] == "subject" || tag[0] == "title" {
subject = tag[1] subject = tag[1]
} }
if tag[0] == "summary" { if tag[0] == "summary" {
summary = tag[1] summary = tag[1]
@@ -264,6 +265,8 @@ func renderEvent(w http.ResponseWriter, r *http.Request) {
data.content = strings.ReplaceAll(data.content, placeholderTag, "nostr:"+nreplace) data.content = strings.ReplaceAll(data.content, placeholderTag, "nostr:"+nreplace)
} }
if data.event.Kind == 30023 || data.event.Kind == 30024 { if data.event.Kind == 30023 || data.event.Kind == 30024 {
// Remove duplicate title inside the body
data.content = strings.ReplaceAll(data.content, "# "+subject, "")
data.content = mdToHTML(data.content, data.templateId == TelegramInstantView, false) data.content = mdToHTML(data.content, data.templateId == TelegramInstantView, false)
} else { } else {
// first we run basicFormatting, which turns URLs into their appropriate HTML tags // first we run basicFormatting, which turns URLs into their appropriate HTML tags