mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Export Page.Layout
And at the same time rename and unexport the badly named `Layout()` func. That method is not very usable outside the package. Fixes #1539
This commit is contained in:
@@ -65,7 +65,7 @@ type Page struct {
|
||||
extension string
|
||||
contentType string
|
||||
renderable bool
|
||||
layout string
|
||||
Layout string
|
||||
linkTitle string
|
||||
frontmatter []byte
|
||||
rawContent []byte
|
||||
@@ -302,9 +302,9 @@ func (p *Page) Section() string {
|
||||
return p.Source.Section()
|
||||
}
|
||||
|
||||
func (p *Page) Layout(l ...string) []string {
|
||||
if p.layout != "" {
|
||||
return layouts(p.Type(), p.layout)
|
||||
func (p *Page) layouts(l ...string) []string {
|
||||
if p.Layout != "" {
|
||||
return layouts(p.Type(), p.Layout)
|
||||
}
|
||||
|
||||
layout := ""
|
||||
@@ -541,7 +541,7 @@ func (p *Page) update(f interface{}) error {
|
||||
published = new(bool)
|
||||
*published = cast.ToBool(v)
|
||||
case "layout":
|
||||
p.layout = cast.ToString(v)
|
||||
p.Layout = cast.ToString(v)
|
||||
case "markup":
|
||||
p.Markup = cast.ToString(v)
|
||||
case "weight":
|
||||
@@ -764,7 +764,7 @@ func (p *Page) Render(layout ...string) template.HTML {
|
||||
if len(layout) > 0 {
|
||||
l = layouts(p.Type(), layout[0])
|
||||
} else {
|
||||
l = p.Layout()
|
||||
l = p.layouts()
|
||||
}
|
||||
|
||||
return tpl.ExecuteTemplateToHTML(p, l...)
|
||||
|
Reference in New Issue
Block a user