summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/page.go24
-rw-r--r--hugolib/site_sections.go23
-rw-r--r--hugolib/site_sections_test.go4
3 files changed, 5 insertions, 46 deletions
diff --git a/hugolib/page.go b/hugolib/page.go
index c6af07b3a..564524825 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -412,26 +412,12 @@ func (p *Page) createLayoutDescriptor() output.LayoutDescriptor {
default:
}
- var typeCurrentSection string
- var typeRootSection string
- curr := p.CurrentSection()
- // Make sure we use the contentType only. This is the value from front matter.
- if curr != nil {
- typeCurrentSection = curr.contentType
- }
- first := p.FirstSection()
- if first != nil {
- typeRootSection = first.contentType
- }
-
return output.LayoutDescriptor{
- Kind: p.Kind,
- Type: p.Type(),
- Lang: p.Lang(),
- Layout: p.Layout,
- Section: section,
- TypeCurrentSection: typeCurrentSection,
- TypeFirstSection: typeRootSection,
+ Kind: p.Kind,
+ Type: p.Type(),
+ Lang: p.Lang(),
+ Layout: p.Layout,
+ Section: section,
}
}
diff --git a/hugolib/site_sections.go b/hugolib/site_sections.go
index 2a92a3424..b87388c59 100644
--- a/hugolib/site_sections.go
+++ b/hugolib/site_sections.go
@@ -58,29 +58,6 @@ func (p *Page) CurrentSection() *Page {
return v.parent
}
-// FirstSection returns the section on level 1 below home, e.g. "/docs".
-// For the home page, this will return itself.
-func (p *Page) FirstSection() *Page {
- v := p
- if v.origOnCopy != nil {
- v = v.origOnCopy
- }
-
- if v.parent == nil || v.parent.IsHome() {
- return v
- }
-
- parent := v.parent
- for {
- current := parent
- parent = parent.parent
- if parent == nil || parent.IsHome() {
- return current
- }
- }
-
-}
-
// InSection returns whether the given page is in the current section.
// Note that this will always return false for pages that are
// not either regular, home or section pages.
diff --git a/hugolib/site_sections_test.go b/hugolib/site_sections_test.go
index 01550c9fa..772d23e23 100644
--- a/hugolib/site_sections_test.go
+++ b/hugolib/site_sections_test.go
@@ -176,8 +176,6 @@ 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)
@@ -252,8 +250,6 @@ PAG|{{ .Title }}|{{ $sect.InSection . }}
assert.NoError(err)
assert.False(isAncestor)
- assert.Equal(l1, p.FirstSection())
-
}},
{"perm a,link", func(p *Page) {
assert.Equal("T9_-1", p.title)