diff options
Diffstat (limited to 'tpl/page/integration_test.go')
-rw-r--r-- | tpl/page/integration_test.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tpl/page/integration_test.go b/tpl/page/integration_test.go index 30a4885e0..74788377d 100644 --- a/tpl/page/integration_test.go +++ b/tpl/page/integration_test.go @@ -177,3 +177,35 @@ Shortcode in bundled page OK. } } + +// Issue 10791. +func TestPageTableOfContentsInShortcode(t *testing.T) { + t.Parallel() + + files := ` +-- config.toml -- +baseURL = 'http://example.com/' +disableKinds = ["taxonomy", "term"] +-- content/p1.md -- +--- +title: "P1" +--- +{{< toc >}} + +# Heading 1 +-- layouts/shortcodes/toc.html -- +{{ page.TableOfContents }} +-- layouts/_default/single.html -- +{{ .Content }} +` + + b := hugolib.NewIntegrationTestBuilder( + hugolib.IntegrationTestConfig{ + T: t, + TxtarString: files, + }, + ).Build() + + b.AssertFileContent("public/p1/index.html", "<nav id=\"TableOfContents\"></nav> \n<h1 id=\"heading-1\">Heading 1</h1>") + +} |