diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-06-01 10:19:05 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-06-01 12:04:55 +0200 |
commit | 212d9e3017c32b91ffc73a6a08e73f34beb1e224 (patch) | |
tree | 6e6e99adb457ca815cd98fc508ae1ae119147536 /hugolib/renderstring_test.go | |
parent | 4daac654d90bdc6adf92bf8b15a4aa45d7d62efd (diff) |
Fix panic with markdownify/RenderString with shortcode on Page with no content file
Fixes #9959
Diffstat (limited to 'hugolib/renderstring_test.go')
-rw-r--r-- | hugolib/renderstring_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/hugolib/renderstring_test.go b/hugolib/renderstring_test.go index d2f453c33..1be0cdffb 100644 --- a/hugolib/renderstring_test.go +++ b/hugolib/renderstring_test.go @@ -158,5 +158,35 @@ Page Type: *hugolib.pageForShortcode`, ) }) +} + +// Issue 9959 +func TestRenderStringWithShortcodeInPageWithNoContentFile(t *testing.T) { + t.Parallel() + + files := ` +-- config.toml -- +-- layouts/shortcodes/myshort.html -- +Page Kind: {{ .Page.Kind }} +-- layouts/index.html -- +Short: {{ .RenderString "{{< myshort >}}" }} +Has myshort: {{ .HasShortcode "myshort" }} +Has other: {{ .HasShortcode "other" }} + + ` + + b := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + }, + ).Build() + + b.AssertFileContent("public/index.html", + ` +Page Kind: home +Has myshort: true +Has other: false +`) } |