diff --git a/hugolib/alias.go b/hugolib/alias.go
index 63f0bb996..7120e6086 100644
--- a/hugolib/alias.go
+++ b/hugolib/alias.go
@@ -3,7 +3,7 @@
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
-// http://wwa.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -29,7 +29,7 @@ import (
const (
alias = "
{{ .Permalink }}"
- aliasXHtml = "{{ .Permalink }}"
+ aliasXHtml = "{{ .Permalink }}"
)
var defaultAliasTemplates *template.Template
diff --git a/hugolib/page.go b/hugolib/page.go
index 2f21eb313..f477e6a14 100644
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -656,23 +656,6 @@ func (p *Page) Section() string {
return p.Source.Section()
}
-func (p *Page) layouts(layouts ...string) []string {
- // TODO(bep) output the logic here needs to be redone.
- if len(layouts) == 0 && len(p.layoutsCalculated) > 0 {
- return p.layoutsCalculated
- }
-
- layoutOverride := ""
- if len(layouts) > 0 {
- layoutOverride = layouts[0]
- }
-
- return p.s.layoutHandler.For(
- p.layoutDescriptor,
- layoutOverride,
- output.HTMLType)
-}
-
// TODO(bep) consolidate and test these KindHome switches (see other layouts methods)s
// rssLayouts returns RSS layouts to use for the RSS version of this page, nil
// if no RSS should be rendered.
@@ -1285,11 +1268,6 @@ func (p *Page) Menus() PageMenus {
return p.pageMenus
}
-func (p *Page) Render(layout ...string) template.HTML {
- l := p.layouts(layout...)
- return p.s.Tmpl.ExecuteTemplateToHTML(p, l...)
-}
-
func (p *Page) determineMarkupType() string {
// Try markup explicitly set in the frontmatter
p.Markup = helpers.GuessType(p.Markup)
@@ -1420,7 +1398,6 @@ func (p *Page) FullFilePath() string {
func (p *Page) prepareLayouts() error {
// TODO(bep): Check the IsRenderable logic.
if p.Kind == KindPage {
- var layouts []string
if !p.IsRenderable() {
// TODO(bep) output
self := "__" + p.UniqueID()
@@ -1428,11 +1405,8 @@ func (p *Page) prepareLayouts() error {
if err != nil {
return err
}
- layouts = append(layouts, self)
- } else {
- layouts = append(layouts, p.layouts()...)
+ p.layoutsCalculated = []string{self}
}
- p.layoutsCalculated = layouts
}
return nil
}
diff --git a/hugolib/page_output.go b/hugolib/page_output.go
index de51a4401..fa9a45190 100644
--- a/hugolib/page_output.go
+++ b/hugolib/page_output.go
@@ -14,6 +14,7 @@
package hugolib
import (
+ "html/template"
"sync"
"github.com/spf13/hugo/output"
@@ -81,3 +82,30 @@ func (p *PageOutput) copy() *PageOutput {
}
return c
}
+
+func (p *PageOutput) layouts(layouts ...string) []string {
+ // TODO(bep) output the logic here needs to be redone.
+ if len(layouts) == 0 && len(p.layoutsCalculated) > 0 {
+ return p.layoutsCalculated
+ }
+
+ layoutOverride := ""
+ if len(layouts) > 0 {
+ layoutOverride = layouts[0]
+ }
+
+ return p.s.layoutHandler.For(
+ p.layoutDescriptor,
+ layoutOverride,
+ p.outputFormat)
+}
+
+func (p *PageOutput) Render(layout ...string) template.HTML {
+ l := p.layouts(layout...)
+ return p.s.Tmpl.ExecuteTemplateToHTML(p, l...)
+}
+
+// TODO(bep) output
+func (p *Page) Render(layout ...string) template.HTML {
+ return p.mainPageOutput.Render(layout...)
+}
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index ac615ab89..d23918603 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -547,12 +547,6 @@ func checkPageType(t *testing.T, page *Page, pageType string) {
}
}
-func checkPageLayout(t *testing.T, page *Page, layout ...string) {
- if !listEqual(page.layouts(), layout) {
- t.Fatalf("Page layout is:\n%s. Expected:\n%s", page.layouts(), layout)
- }
-}
-
func checkPageDate(t *testing.T, page *Page, time time.Time) {
if page.Date != time {
t.Fatalf("Page date is: %s. Expected: %s", page.Date, time)
@@ -659,11 +653,6 @@ func TestCreateNewPage(t *testing.T) {
checkPageContent(t, p, normalizeExpected(ext, "