package main import ( "log" "strings" "willnorris.com/go/webmention" ) func SendWebmentions(url string) { client := webmention.New(nil) dl, err := client.DiscoverLinks(url, ".h-entry") if err != nil { return } for _, link := range dl { blogUrl, err := GetBlogURL() if err != nil || strings.HasPrefix(link, blogUrl) { continue } endpoint, err := client.DiscoverEndpoint(link) if err != nil || len(endpoint) < 1 { continue } _, err = client.SendWebmention(endpoint, url, link) if err != nil { log.Println("Sent webmention to " + link + " failed") continue } log.Println("Sent webmention to " + link) } }