Tweak link filtering when sending Webmention
parent
1c3cc6480f
commit
fb76567cef
|
@ -42,18 +42,20 @@ func SendWebmentions(url string) {
|
|||
|
||||
func filterLinks(links []string) []string {
|
||||
var filteredLinks []string
|
||||
LINKFILTER:
|
||||
for _, link := range links {
|
||||
if strings.HasPrefix(link, BlogUrl) {
|
||||
if strings.HasPrefix(link, strings.TrimSuffix(BlogUrl, "/")) {
|
||||
continue
|
||||
}
|
||||
ignored := false
|
||||
for _, ignoredURL := range IgnoredWebmentionUrls {
|
||||
if strings.HasPrefix(link, ignoredURL) {
|
||||
continue LINKFILTER
|
||||
if !ignored && strings.HasPrefix(link, strings.TrimSuffix(ignoredURL, "/")) {
|
||||
ignored = true
|
||||
}
|
||||
}
|
||||
if ignored != true {
|
||||
filteredLinks = append(filteredLinks, link)
|
||||
}
|
||||
}
|
||||
return filteredLinks
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue