mirror of
https://github.com/jackyzha0/hugo-obsidian.git
synced 2024-06-14 11:42:35 +03:00
patch external link detection
This commit is contained in:
parent
3d6c2bae5e
commit
ff5c1deabc
2
main.go
2
main.go
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user