]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tpl/tplimpl: Create an embedded comment shortcode
authorJoe Mooring <joe.mooring@veriphor.com>
Mon, 4 Nov 2024 19:11:46 +0000 (11:11 -0800)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 4 Nov 2024 20:05:07 +0000 (21:05 +0100)
Closes #13010

tpl/tplimpl/embedded/templates/shortcodes/comment.html [new file with mode: 0644]
tpl/tplimpl/tplimpl_integration_test.go

diff --git a/tpl/tplimpl/embedded/templates/shortcodes/comment.html b/tpl/tplimpl/embedded/templates/shortcodes/comment.html
new file mode 100644 (file)
index 0000000..cb32934
--- /dev/null
@@ -0,0 +1 @@
+{{- $noop := .Inner -}}
index a8599bbade6270ce1abf222e7306d5be11857a84..c7e118e825915fead0136d4c9058298fb1262a8a 100644 (file)
@@ -584,3 +584,19 @@ title: p5
                `<meta name="twitter:description" content="m n and **o** can&#39;t.">`,
        )
 }
+
+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", "<p>ac</p>")
+}