Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-03-09 14:04:33 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-03-09 17:01:55 +0300
commitffcb4aeb8e392a80da7cad0f1e03a4102efb24ec (patch)
tree945afe631ef8451f8a401b0a159a78b64e905713 /tpl
parent8279d2e2271ee64725133d36a12d1d7e2158bffd (diff)
Fix handling of HTML files without front matter
This means that any HTML file inside /content will be treated as a regular file. If you want it processes with shortcodes and a layout, add front matter. The defintion of an HTML file here is: * File with extension .htm or .html * With first non-whitespace character "<" that isn't a HTML comment. This is in line with the documentation. Fixes #7030 Fixes #7028 See #6789
Diffstat (limited to 'tpl')
-rw-r--r--tpl/template.go1
-rw-r--r--tpl/tplimpl/template.go32
2 files changed, 2 insertions, 31 deletions
diff --git a/tpl/template.go b/tpl/template.go
index b9b0749b6..315004b6a 100644
--- a/tpl/template.go
+++ b/tpl/template.go
@@ -29,7 +29,6 @@ type TemplateManager interface {
TemplateHandler
TemplateFuncGetter
AddTemplate(name, tpl string) error
- AddLateTemplate(name, tpl string) error
MarkReady() error
}
diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go
index b6313e1e5..c01b62136 100644
--- a/tpl/tplimpl/template.go
+++ b/tpl/tplimpl/template.go
@@ -251,21 +251,8 @@ func (t *templateExec) MarkReady() error {
}
})
- if err != nil {
- return err
- }
-
- if t.Deps.BuildFlags.HasLateTemplate.Load() {
- // This costs memory, so try to avoid it if we don't have to.
- // The late templates are used to handle HTML in files in /content
- // without front matter.
- t.readyLateInit.Do(func() {
- t.late = t.main.Clone(true)
- t.late.createPrototypes()
- })
- }
+ return err
- return nil
}
type templateHandler struct {
@@ -273,10 +260,7 @@ type templateHandler struct {
needsBaseof map[string]templateInfo
baseof map[string]templateInfo
- late *templateNamespace // Templates added after main has started executing.
-
- readyInit sync.Once
- readyLateInit sync.Once
+ readyInit sync.Once
// This is the filesystem to load the templates from. All the templates are
// stored in the root of this filesystem.
@@ -309,14 +293,6 @@ type templateHandler struct {
templateInfo map[string]tpl.Info
}
-// AddLateTemplate is used to add a template after the
-// regular templates have started its execution.
-// These are currently "pure HTML content files".
-func (t *templateHandler) AddLateTemplate(name, tpl string) error {
- _, err := t.late.parse(t.newTemplateInfo(name, tpl))
- return err
-}
-
// AddTemplate parses and adds a template to the collection.
// Templates with name prefixed with "_text" will be handled as plain
// text templates.
@@ -334,10 +310,6 @@ func (t *templateHandler) Lookup(name string) (tpl.Template, bool) {
return templ, true
}
- if t.late != nil {
- return t.late.Lookup(name)
- }
-
return nil, false
}