diff --git a/hugolib/page__content.go b/hugolib/page__content.go index 1b40c2ae7..593c5b9a1 100644 --- a/hugolib/page__content.go +++ b/hugolib/page__content.go @@ -53,7 +53,7 @@ func (p pageContent) contentToRender(renderedShortcodes map[string]string) []byt case pageContentReplacement: c = append(c, v.val...) case *shortcode: - if v.doMarkup || !p.renderable { + if !p.renderable || !v.insertPlaceholder() { // Insert the rendered shortcode. renderedShortcode, found := renderedShortcodes[v.placeholder] if !found { @@ -127,9 +127,9 @@ func (p *pageContentMap) AddReplacement(val []byte, source pageparser.Item) { func (p *pageContentMap) AddShortcode(s *shortcode) { p.items = append(p.items, s) - if s.doMarkup { - p.hasMarkdownShortcode = true - } else { + if s.insertPlaceholder() { p.hasNonMarkdownShortcode = true + } else { + p.hasMarkdownShortcode = true } } diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index 68455d30f..895d0dcf2 100644 --- a/hugolib/shortcode.go +++ b/hugolib/shortcode.go @@ -201,6 +201,10 @@ type shortcode struct { length int // the length in bytes in the source file } +func (s shortcode) insertPlaceholder() bool { + return !s.doMarkup || s.info.Config.Version == 1 +} + func (s shortcode) innerString() string { var sb strings.Builder diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index ea56bf792..42eef61ae 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -531,6 +531,13 @@ tags: **Tags:** {{< tags >}}`, filepath.FromSlash("public/sect/doc11/index.html"), "
Tags: 2
\n"}, + {"sect/doc12.md", `--- +title: "Foo" +--- + +{{% html-indented-v1 %}}`, + "public/sect/doc12/index.html", + "