tpl/tplimpl: Throw error when calling gist shortcode

Closes #14491
This commit is contained in:
Joe Mooring
2026-02-12 04:49:23 -08:00
committed by GitHub
parent 55d136dd66
commit 4384f9b8c2
2 changed files with 22 additions and 22 deletions
@@ -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." -}}
+21 -20
View 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.`)
}