From 4384f9b8c2af5d7d79ed1f411a4af639ba69fa09 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Thu, 12 Feb 2026 04:49:23 -0800 Subject: [PATCH] tpl/tplimpl: Throw error when calling gist shortcode Closes #14491 --- .../embedded/templates/_shortcodes/gist.html | 3 +- tpl/tplimpl/shortcodes_integration_test.go | 41 ++++++++++--------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tpl/tplimpl/embedded/templates/_shortcodes/gist.html b/tpl/tplimpl/embedded/templates/_shortcodes/gist.html index 316d2d54e..c11801545 100644 --- a/tpl/tplimpl/embedded/templates/_shortcodes/gist.html +++ b/tpl/tplimpl/embedded/templates/_shortcodes/gist.html @@ -1,2 +1 @@ -{{- warnf "The %q shortcode was deprecated in v0.143.0 and will be removed in a future release. See https://gohugo.io/shortcodes/gist for instructions to create a replacement." .Name -}} - +{{- errorf "The \"gist\" shortcode was deprecated in v0.143.0 and removed in v0.156.0." -}} diff --git a/tpl/tplimpl/shortcodes_integration_test.go b/tpl/tplimpl/shortcodes_integration_test.go index 6a0c20c69..20f275249 100644 --- a/tpl/tplimpl/shortcodes_integration_test.go +++ b/tpl/tplimpl/shortcodes_integration_test.go @@ -125,26 +125,6 @@ Content: {{ .Content }} b.AssertFileContent("public/index.html", "35b077dcb9887a84") } -func TestGistShortcode(t *testing.T) { - t.Parallel() - - files := ` --- hugo.toml -- -disableKinds = ['page','rss','section','sitemap','taxonomy','term'] --- layouts/home.html -- -{{ .Content }} --- content/_index.md -- ---- -title: home ---- -{{< gist jmooring 23932424365401ffa5e9d9810102a477 >}} -` - - b := hugolib.Test(t, files, hugolib.TestOptWarn()) - b.AssertFileContent("public/index.html", ``) - b.AssertLogContains(`WARN The "gist" shortcode was deprecated in v0.143.0 and will be removed in a future release. See https://gohugo.io/shortcodes/gist for instructions to create a replacement.`) -} - func TestHighlightShortcode(t *testing.T) { t.Parallel() @@ -890,3 +870,24 @@ title: p1 b.AssertLogContains(want) } } + +// Issue 14491 +func TestGistShortcodeDeprecationError14491(t *testing.T) { + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['page','rss','section','sitemap','taxonomy','term'] +-- layouts/home.html -- +{{ .Content }} +-- content/_index.md -- +--- +title: home +--- +{{< gist user 23932424365401ffa5e9d9810102a477 >}} +` + + b, err := hugolib.TestE(t, files, hugolib.TestOptWarn()) + b.Assert(err, qt.IsNotNil) + b.AssertLogContains(`ERROR The "gist" shortcode was deprecated in v0.143.0 and removed in v0.156.0.`) +} -- 2.39.5