]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tpl/tplimpl: Throw error when calling gist shortcode
authorJoe Mooring <joe@mooring.com>
Thu, 12 Feb 2026 12:49:23 +0000 (04:49 -0800)
committerGitHub <noreply@github.com>
Thu, 12 Feb 2026 12:49:23 +0000 (13:49 +0100)
Closes #14491

tpl/tplimpl/embedded/templates/_shortcodes/gist.html
tpl/tplimpl/shortcodes_integration_test.go

index 316d2d54ece07f499aab8c011d8e982f4b36f65d..c11801545868daaab5fc6eb726cfe7885edda8e9 100644 (file)
@@ -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 -}}
-<script src="https://gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js{{if len .Params | eq 3 }}?file={{ index .Params 2 }}{{end}}"></script>
+{{- errorf "The \"gist\" shortcode was deprecated in v0.143.0 and removed in v0.156.0." -}}
index 6a0c20c69057c91adb2e69292674c2d437461ded..20f275249c8c2931fce6e5871196c344b67e63a6 100644 (file)
@@ -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", `<script src="https://gist.github.com/jmooring/23932424365401ffa5e9d9810102a477.js"></script>`)
-       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.`)
+}