summaryrefslogtreecommitdiffstats
path: root/hugolib/renderstring_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-06-01 10:19:05 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-06-01 12:04:55 +0200
commit212d9e3017c32b91ffc73a6a08e73f34beb1e224 (patch)
tree6e6e99adb457ca815cd98fc508ae1ae119147536 /hugolib/renderstring_test.go
parent4daac654d90bdc6adf92bf8b15a4aa45d7d62efd (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.go30
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
+`)
}