From 801035bb7a38beae214105e872a4cdc49ac610ce Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Mon, 4 Nov 2024 11:11:46 -0800 Subject: tpl/tplimpl: Create an embedded comment shortcode Closes #13010 --- tpl/tplimpl/embedded/templates/shortcodes/comment.html | 1 + tpl/tplimpl/tplimpl_integration_test.go | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tpl/tplimpl/embedded/templates/shortcodes/comment.html diff --git a/tpl/tplimpl/embedded/templates/shortcodes/comment.html b/tpl/tplimpl/embedded/templates/shortcodes/comment.html new file mode 100644 index 000000000..cb3293401 --- /dev/null +++ b/tpl/tplimpl/embedded/templates/shortcodes/comment.html @@ -0,0 +1 @@ +{{- $noop := .Inner -}} diff --git a/tpl/tplimpl/tplimpl_integration_test.go b/tpl/tplimpl/tplimpl_integration_test.go index a8599bbad..c7e118e82 100644 --- a/tpl/tplimpl/tplimpl_integration_test.go +++ b/tpl/tplimpl/tplimpl_integration_test.go @@ -584,3 +584,19 @@ title: p5 ``, ) } + +func TestCommentShortcode(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['page','rss','section','sitemap','taxonomy','term'] +-- layouts/index.html -- +{{ .Content }} +-- content/_index.md -- +a{{< comment >}}b{{< /comment >}}c +` + + b := hugolib.Test(t, files) + b.AssertFileContent("public/index.html", "

ac

") +} -- cgit v1.2.3