mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 21:51:02 +03:00
Unify page lookups
This commit unifies the core internal page index for all page kinds. This enables the `ref` and `relref` shortcodes to support all pages kinds, and adds a new page-relative `.GetPage` method with simplified signature. See #4147 See #4727 See #4728 See #4728 See #4726 See #4652
This commit is contained in:
parent
fd1f4a7860
commit
b93417aa1d
16 changed files with 294 additions and 153 deletions
|
@ -117,12 +117,12 @@ Do not go gentle into that good night.
|
|||
|
||||
assert.Len(s.RegularPages, 2)
|
||||
|
||||
notUgly := s.getPage(KindPage, "sect1/p1.md")
|
||||
notUgly, _ := s.getPage(nil, "sect1/p1.md")
|
||||
assert.NotNil(notUgly)
|
||||
assert.Equal("sect1", notUgly.Section())
|
||||
assert.Equal("/sect1/p1/", notUgly.RelPermalink())
|
||||
|
||||
ugly := s.getPage(KindPage, "sect2/p2.md")
|
||||
ugly, _ := s.getPage(nil, "sect2/p2.md")
|
||||
assert.NotNil(ugly)
|
||||
assert.Equal("sect2", ugly.Section())
|
||||
assert.Equal("/sect2/p2.html", ugly.RelPermalink())
|
||||
|
@ -175,7 +175,7 @@ Do not go gentle into that good night.
|
|||
|
||||
assert.Len(s.RegularPages, 10)
|
||||
|
||||
sect1 := s.getPage(KindSection, "sect1")
|
||||
sect1, _ := s.getPage(nil, "sect1")
|
||||
assert.NotNil(sect1)
|
||||
assert.Equal("/ss1/", sect1.RelPermalink())
|
||||
th.assertFileContent(filepath.Join("public", "ss1", "index.html"), "P1|URL: /ss1/|Next: /ss1/page/2/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue