mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
Add Page.FirstSection
It was added and then removed by accident some time ago. Let us add it again, as it is useful.
This commit is contained in:
@@ -176,6 +176,7 @@ PAG|{{ .Title }}|{{ $sect.InSection . }}
|
||||
active, err := home.InSection(home)
|
||||
assert.NoError(err)
|
||||
assert.True(active)
|
||||
assert.Equal(p, p.FirstSection())
|
||||
}},
|
||||
{"l1", func(p *Page) {
|
||||
assert.Equal("L1s", p.title)
|
||||
@@ -249,6 +250,7 @@ PAG|{{ .Title }}|{{ $sect.InSection . }}
|
||||
isAncestor, err = p.IsAncestor(l1)
|
||||
assert.NoError(err)
|
||||
assert.False(isAncestor)
|
||||
assert.Equal(l1, p.FirstSection())
|
||||
|
||||
}},
|
||||
{"perm a,link", func(p *Page) {
|
||||
|
Reference in New Issue
Block a user