Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content adapter: Shortcode not rendered unless preceded by character #12544

Closed
jmooring opened this issue May 28, 2024 · 1 comment
Closed

content adapter: Shortcode not rendered unless preceded by character #12544

jmooring opened this issue May 28, 2024 · 1 comment

Comments

@jmooring
Copy link
Member

jmooring commented May 28, 2024

Reference: https://discourse.gohugo.io/t/50052

This works:

{{ $content := dict "mediaType" "text/markdown" "value" "x{{< sc >}}" }}

This does not (nothing is rendered):

{{ $content := dict "mediaType" "text/markdown" "value" "{{< sc >}}" }}

Test case:

func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
-- content/_content.gotmpl --
{{ $content := dict "mediaType" "text/markdown" "value" "x{{< sc >}}" }}
{{ .AddPage (dict "content" $content "path" "a") }}

{{ $content := dict "mediaType" "text/markdown" "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", "<p>xfoo</p>")
	b.AssertFileContent("public/b/index.html", "<p>foo</p>") // fails
}
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants