The current tracking of nested page context (typically used for inclusion of content and having any relative links resolve correctly) assume that we're rendering content (either via Page.Content or Page.RenderString).
This means that the test below fails (the content never gets rendered to HTML, so the wrapper strings gets left behind).
See #12457 for a bigger discussion about this, but one use case for the below would be output format that just outputs ... Markdown.
And we should be able to detect and handle this scenario, as we already do similar checks.
func TestRenderShortcodesStandalone(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['section','rss','sitemap','taxonomy','term']
-- layouts/all.html --
RenderShortcodes: {{ .RenderShortcodes }}|
-- layouts/_shortcodes/headings.html --
## Heading 1
### Heading 2
{{ $p := site.GetPage "includeme" }}
RenderShortcodes2: {{ $p.RenderShortcodes }}|
-- content/p1.md --
title: "p1"
---
{{% headings "headings" %}}
-- content/includeme.md --
---
title: "includeme"
---
## Heading 2
`
b := Test(t, files)
b.AssertNoRenderShortcodesArtifacts()
}
The current tracking of nested page context (typically used for inclusion of content and having any relative links resolve correctly) assume that we're rendering content (either via
Page.ContentorPage.RenderString).This means that the test below fails (the content never gets rendered to HTML, so the wrapper strings gets left behind).
See #12457 for a bigger discussion about this, but one use case for the below would be output format that just outputs ... Markdown.
And we should be able to detect and handle this scenario, as we already do similar checks.