Skip to content

Commit

Permalink
hugolib: Add the last lookup variant for the GetPage index
Browse files Browse the repository at this point in the history
Now, even for nun-bundles it is possible to do lookup without path or extension.

So, given `blog/my-blog-post.en.md` these lookups will succeed:

* `blog/my-blog-post.en.md`
* `blog/my-blog-post`
* `my-blog-post.en.md`
* `my-blog-post`

See #4312
See gohugoio/hugoDocs#307
  • Loading branch information
bep committed Jan 24, 2018
1 parent 4a7c2b3 commit 3446fe9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hugolib/page_bundler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func TestPageBundlerSite(t *testing.T) {
singlePage := s.getPage(KindPage, "a/1.md")

assert.NotNil(singlePage)
assert.Equal(singlePage, s.getPage("page", "a/1"))
assert.Equal(singlePage, s.getPage("page", "1"))

assert.Contains(singlePage.Content, "TheContent")

if ugly {
Expand Down
3 changes: 3 additions & 0 deletions hugolib/page_collections.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func (c *PageCollections) refreshPageCaches() {
_, name := path.Split(dir)
cache[name] = p
cache[dir] = p
} else {
// Again, ambigous
cache[translasionBaseName] = p
}

// We need a way to get to the current language version.
Expand Down

0 comments on commit 3446fe9

Please sign in to comment.