mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
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
This commit is contained in:
@@ -449,12 +449,6 @@ func (p *pageState) initOutputFormat(isRenderingSite bool, idx int) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !p.renderable {
|
||||
if _, err := p.Content(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
@@ -679,8 +673,6 @@ func (p *pageState) mapContent(bucket *pagesMapBucket, meta *pageMeta) error {
|
||||
|
||||
s := p.shortcodeState
|
||||
|
||||
p.renderable = true
|
||||
|
||||
rn := &pageContentMap{
|
||||
items: make([]interface{}, 0, 20),
|
||||
}
|
||||
@@ -703,12 +695,6 @@ Loop:
|
||||
|
||||
switch {
|
||||
case it.Type == pageparser.TypeIgnore:
|
||||
case it.Type == pageparser.TypeHTMLStart:
|
||||
// This is HTML without front matter. It can still have shortcodes.
|
||||
p.selfLayout = "__" + p.File().Filename()
|
||||
p.renderable = false
|
||||
p.s.BuildFlags.HasLateTemplate.CAS(false, true)
|
||||
rn.AddBytes(it)
|
||||
case it.IsFrontMatter():
|
||||
f := pageparser.FormatFromFrontMatterType(it.Type)
|
||||
m, err := metadecoders.Default.UnmarshalToMap(it.Val, f)
|
||||
|
Reference in New Issue
Block a user