Skip to content

Commit

Permalink
hugolib: Fix redundant URL file extension on taxonomy terms pages
Browse files Browse the repository at this point in the history
Fixes #2819
  • Loading branch information
moorereason authored and bep committed Dec 27, 2016
1 parent e78dd3c commit 17f8517
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions hugolib/node_as_page_test.go
Expand Up @@ -222,6 +222,19 @@ func doTestNodesWithNoContentFile(t *testing.T, ugly bool) {
"Taxonomy Terms Title: Categories",
)

pages := s.findPagesByKind(KindTaxonomyTerm)
for _, p := range pages {
var want string
if ugly {
want = "/" + p.Site.pathSpec.URLize(p.Title) + ".html"
} else {
want = "/" + p.Site.pathSpec.URLize(p.Title) + "/"
}
if p.URL() != want {
t.Errorf("Taxonomy term URL mismatch: want %q, got %q", want, p.URL())
}
}

// Sections
assertFileContent(t, expectedFilePath(ugly, "public", "sect1"), false,
"Section Title: Sect1s",
Expand Down
2 changes: 1 addition & 1 deletion hugolib/page.go
Expand Up @@ -758,7 +758,7 @@ func (p *Page) createPermalink() (*url.URL, error) {
// No permalink config for nodes (currently)
pURL := strings.TrimSpace(p.Site.pathSpec.URLize(p.URLPath.URL))
pURL = p.addLangPathPrefix(pURL)
pURL = p.Site.pathSpec.URLPrep(path.Join(pURL, "index."+p.Extension()))
pURL = p.Site.pathSpec.URLPrep(pURL)
url := helpers.MakePermalink(baseURL, pURL)
return url, nil
}
Expand Down

0 comments on commit 17f8517

Please sign in to comment.