From 18a0bfd15b58346241158e76ebc5b8bedeca5154 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Fri, 23 Jul 2021 07:02:49 +0200 Subject: [PATCH] Add option to set "webmention: false" in post params to not send webmentions --- webmentionSending.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webmentionSending.go b/webmentionSending.go index d946d80..14fea6e 100644 --- a/webmentionSending.go +++ b/webmentionSending.go @@ -14,6 +14,8 @@ import ( "go.goblog.app/app/pkgs/contenttype" ) +const postParamWebmention = "webmention" + func (a *goBlog) sendWebmentions(p *post) error { if p.Status != statusPublished && p.Status != statusUnlisted { // Not published or unlisted @@ -23,6 +25,10 @@ func (a *goBlog) sendWebmentions(p *post) error { // Just ignore the mentions return nil } + if pp, ok := p.Parameters[postParamWebmention]; ok && len(pp) > 0 && pp[0] == "false" { + // Ignore this post + return nil + } links := []string{} contentLinks, err := allLinksFromHTML(strings.NewReader(string(a.postHtml(p, false))), a.fullPostURL(p)) if err != nil {