diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-15 20:40:39 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-17 16:22:33 +0100 |
commit | 20c9b6ec81171d1c586ea31d5d08b40b0edaffc6 (patch) | |
tree | 990d2709c1333663dce2ff97f16f8791fef3bac9 /hugolib/site_sections_test.go | |
parent | f8a119b606d55aa4f31f16e5a3cadc929c99e4f8 (diff) |
resource: Add front matter metadata to Resource
This commit expands the Resource interface with 3 new methods:
* Name
* Title
* Params
All of these can be set in the Page front matter. `Name` will get its default value from the base filename, and is the value used in the ByPrefix and GetByPrefix lookup methods.
Fixes #4244
Diffstat (limited to 'hugolib/site_sections_test.go')
-rw-r--r-- | hugolib/site_sections_test.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/hugolib/site_sections_test.go b/hugolib/site_sections_test.go index 8b5b37fcc..a1b80407c 100644 --- a/hugolib/site_sections_test.go +++ b/hugolib/site_sections_test.go @@ -143,13 +143,13 @@ PAG|{{ .Title }}|{{ $sect.InSection . }} // > b,c,d where b and d have content files. b := p.s.getPage(KindSection, "empty2", "b") assert.NotNil(b) - assert.Equal("T40_-1", b.Title) + assert.Equal("T40_-1", b.title) c := p.s.getPage(KindSection, "empty2", "b", "c") assert.NotNil(c) - assert.Equal("Cs", c.Title) + assert.Equal("Cs", c.title) d := p.s.getPage(KindSection, "empty2", "b", "c", "d") assert.NotNil(d) - assert.Equal("T41_-1", d.Title) + assert.Equal("T41_-1", d.title) assert.False(c.Eq(d)) assert.True(c.Eq(c)) @@ -165,7 +165,7 @@ PAG|{{ .Title }}|{{ $sect.InSection . }} }}, {"top", func(p *Page) { - assert.Equal("Tops", p.Title) + assert.Equal("Tops", p.title) assert.Len(p.Pages, 2) assert.Equal("mypage2.md", p.Pages[0].LogicalName()) assert.Equal("mypage3.md", p.Pages[1].LogicalName()) @@ -178,16 +178,16 @@ PAG|{{ .Title }}|{{ $sect.InSection . }} assert.True(active) }}, {"l1", func(p *Page) { - assert.Equal("L1s", p.Title) + assert.Equal("L1s", p.title) assert.Len(p.Pages, 2) assert.True(p.Parent().IsHome()) assert.Len(p.Sections(), 2) }}, {"l1,l2", func(p *Page) { - assert.Equal("T2_-1", p.Title) + assert.Equal("T2_-1", p.title) assert.Len(p.Pages, 3) assert.Equal(p, p.Pages[0].Parent()) - assert.Equal("L1s", p.Parent().Title) + assert.Equal("L1s", p.Parent().title) assert.Equal("/l1/l2/", p.URLPath.URL) assert.Equal("/l1/l2/", p.RelPermalink()) assert.Len(p.Sections(), 1) @@ -223,16 +223,16 @@ PAG|{{ .Title }}|{{ $sect.InSection . }} }}, {"l1,l2_2", func(p *Page) { - assert.Equal("T22_-1", p.Title) + assert.Equal("T22_-1", p.title) assert.Len(p.Pages, 2) assert.Equal(filepath.FromSlash("l1/l2_2/page_2_2_1.md"), p.Pages[0].Path()) - assert.Equal("L1s", p.Parent().Title) + assert.Equal("L1s", p.Parent().title) assert.Len(p.Sections(), 0) }}, {"l1,l2,l3", func(p *Page) { - assert.Equal("T3_-1", p.Title) + assert.Equal("T3_-1", p.title) assert.Len(p.Pages, 2) - assert.Equal("T2_-1", p.Parent().Title) + assert.Equal("T2_-1", p.Parent().title) assert.Len(p.Sections(), 0) l1 := p.s.getPage(KindSection, "l1") @@ -252,7 +252,7 @@ PAG|{{ .Title }}|{{ $sect.InSection . }} }}, {"perm a,link", func(p *Page) { - assert.Equal("T9_-1", p.Title) + assert.Equal("T9_-1", p.title) assert.Equal("/perm-a/link/", p.RelPermalink()) assert.Len(p.Pages, 4) first := p.Pages[0] |