mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-14 20:33:59 +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:
@@ -42,21 +42,14 @@ LOOP:
|
||||
if r == '<' {
|
||||
l.backup()
|
||||
if l.hasPrefix(htmlCommentStart) {
|
||||
// This may be commented out front mattter, which should
|
||||
// This may be commented out front matter, which should
|
||||
// still be read.
|
||||
l.consumeToNextLine()
|
||||
l.isInHTMLComment = true
|
||||
l.emit(TypeIgnore)
|
||||
continue LOOP
|
||||
} else {
|
||||
if l.pos > l.start {
|
||||
l.emit(tText)
|
||||
}
|
||||
l.next()
|
||||
// This is the start of a plain HTML document with no
|
||||
// front matter. I still can contain shortcodes, so we
|
||||
// have to keep looking.
|
||||
l.emit(TypeHTMLStart)
|
||||
return l.errorf("plain HTML documents not supported")
|
||||
}
|
||||
}
|
||||
break LOOP
|
||||
|
Reference in New Issue
Block a user