Skip to content

Commit 8600fc5

Browse files
jhchabranburmudar
andauthored
Make rel links checker more precise. (#85)
Co-authored-by: William Bezuidenhout <william.bezuidenhout+github@gmail.com>
1 parent d0aac74 commit 8600fc5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

check.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"net/http/httptest"
99
"net/url"
10+
"path/filepath"
1011
"strings"
1112
"sync"
1213

@@ -101,9 +102,9 @@ func (s *Site) checkContentPage(page *contentPageCheckData) (problems []string)
101102
}
102103

103104
if node.Type == blackfriday.Link {
104-
// Require that relative paths link to the actual .md file, so that browsing
105-
// docs on the file system works.
106-
if isPathOnly && u.Path != "" && !strings.HasSuffix(u.Path, ".md") {
105+
// Require that relative paths link to the actual .md file, i.e not the "foo" folder in the case of
106+
// of "foo/index.md", so that browsing docs on the file system works.
107+
if isPathOnly && u.Path != "" && filepath.Ext(u.Path) == "" {
107108
problems = append(problems, fmt.Sprintf("must link to .md file, not %s", u.Path))
108109
}
109110
}

0 commit comments

Comments
 (0)