diff options
author | Bjørn Erik Pedersen <[email protected]> | 2020-02-18 14:00:58 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2020-02-18 14:08:59 +0100 |
commit | 19e12caf8c90516e3b803ae8a40b907bd89dc96c (patch) | |
tree | b3640819a334588ab5c684d540ac177c34ffad15 /hugolib/page__meta.go | |
parent | 20f2211fce55e1811629245f9e5e4a2ac754d788 (diff) | |
download | hugo-19e12caf8c90516e3b803ae8a40b907bd89dc96c.tar.gz hugo-19e12caf8c90516e3b803ae8a40b907bd89dc96c.zip |
Fix RenderString for pages without content
Fixes #6882
Diffstat (limited to 'hugolib/page__meta.go')
-rw-r--r-- | hugolib/page__meta.go | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/hugolib/page__meta.go b/hugolib/page__meta.go index 8ecffbda3..7eb7cbfe1 100644 --- a/hugolib/page__meta.go +++ b/hugolib/page__meta.go @@ -19,6 +19,7 @@ import ( "path/filepath" "regexp" "strings" + "sync" "time" "github.com/gohugoio/hugo/markup/converter" @@ -118,7 +119,9 @@ type pageMeta struct { s *Site - contentConverter converter.Converter + renderingConfigOverrides map[string]interface{} + contentConverterInit sync.Once + contentConverter converter.Converter } func (p *pageMeta) Aliases() []string { @@ -686,17 +689,8 @@ func (p *pageMeta) applyDefaultValues(n *contentNode) error { renderingConfigOverrides = maps.ToStringMap(bfParam) } - markup := p.markup - if markup == "html" { - // Only used for shortcode inner content. - markup = "markdown" - } + p.renderingConfigOverrides = renderingConfigOverrides - cp, err := p.newContentConverter(n.p, markup, renderingConfigOverrides) - if err != nil { - return err - } - p.contentConverter = cp } return nil @@ -709,7 +703,7 @@ func (p *pageMeta) newContentConverter(ps *pageState, markup string, renderingCo } cp := p.s.ContentSpec.Converters.Get(markup) if cp == nil { - return nil, errors.Errorf("no content renderer found for markup %q", p.markup) + return converter.NopConverter, errors.Errorf("no content renderer found for markup %q", p.markup) } cpp, err := cp.New( @@ -722,7 +716,7 @@ func (p *pageMeta) newContentConverter(ps *pageState, markup string, renderingCo ) if err != nil { - return nil, err + return converter.NopConverter, err } return cpp, nil |