mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-24 21:56:05 +02:00
content adapter: Fix issue with content starting out with a shortcode
Fixes #12544
This commit is contained in:
@@ -585,3 +585,28 @@ value: data1
|
||||
|
||||
b.AssertLogNotContains("WARN")
|
||||
}
|
||||
|
||||
func TestPagesFromGoTmplShortcodeNoPreceddingCharacterIssue12544(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
|
||||
-- content/_content.gotmpl --
|
||||
{{ $content := dict "mediaType" "text/html" "value" "x{{< sc >}}" }}
|
||||
{{ .AddPage (dict "content" $content "path" "a") }}
|
||||
|
||||
{{ $content := dict "mediaType" "text/html" "value" "{{< sc >}}" }}
|
||||
{{ .AddPage (dict "content" $content "path" "b") }}
|
||||
-- layouts/_default/single.html --
|
||||
|{{ .Content }}|
|
||||
-- layouts/shortcodes/sc.html --
|
||||
foo
|
||||
{{- /**/ -}}
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
b.AssertFileContent("public/a/index.html", "|xfoo|")
|
||||
b.AssertFileContent("public/b/index.html", "|foo|") // fails
|
||||
}
|
||||
|
Reference in New Issue
Block a user