mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
Fix panic with markdownify/RenderString with shortcode on Page with no content file
Fixes #9959
This commit is contained in:
parent
4daac654d9
commit
212d9e3017
6 changed files with 35 additions and 6 deletions
|
@ -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
|
||||
`)
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue