patch external link detection

This commit is contained in:
jackyzha0 2021-07-18 10:57:08 -04:00
parent 3d6c2bae5e
commit ff5c1deabc

View File

@ -77,7 +77,7 @@ func walk(root, ext string) (res []Link) {
func filter(links []Link) (res []Link) { func filter(links []Link) (res []Link) {
for _, l := range links { for _, l := range links {
// filter external and non-md // filter external and non-md
isInternal := strings.HasPrefix(l.Target, "/") isInternal := !strings.HasPrefix(l.Target, "http")
isMarkdown := filepath.Ext(l.Target) == "" || filepath.Ext(l.Target) == ".md" isMarkdown := filepath.Ext(l.Target) == "" || filepath.Ext(l.Target) == ".md"
if isInternal && isMarkdown { if isInternal && isMarkdown {
res = append(res, l) res = append(res, l)