From 1b76ad25b87636fca6fbe69d6a36fffed81101ee Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Mon, 4 Nov 2024 11:11:46 -0800 Subject: [PATCH] tpl/tplimpl: Create an embedded comment shortcode Closes #13010 --- .../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 00000000000..cb32934018c --- /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 a8599bbade6..c7e118e8259 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

") +}