mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
content adapter: Fix issue with content starting out with a shortcode
Fixes #12544
This commit is contained in:
@@ -62,7 +62,9 @@ func (l *pageLexer) Input() []byte {
|
||||
return l.input
|
||||
}
|
||||
|
||||
type Config struct{}
|
||||
type Config struct {
|
||||
NoFrontMatter bool
|
||||
}
|
||||
|
||||
// note: the input position here is normally 0 (start), but
|
||||
// can be set if position of first shortcode is known
|
||||
|
@@ -36,7 +36,11 @@ var _ Result = (*pageLexer)(nil)
|
||||
|
||||
// ParseBytes parses the page in b according to the given Config.
|
||||
func ParseBytes(b []byte, cfg Config) (Items, error) {
|
||||
l, err := parseBytes(b, cfg, lexIntroSection)
|
||||
startLexer := lexIntroSection
|
||||
if cfg.NoFrontMatter {
|
||||
startLexer = lexMainSection
|
||||
}
|
||||
l, err := parseBytes(b, cfg, startLexer)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user