Repository: gohugoio/hugo (language: go)

Issue:
Deprecate (and eventually remove) the gist shortcode
Working on some new templates for the docs theme, I see this error/warning in the dev console.

<img width="1688" alt="image" src="https://github.com/user-attachments/assets/2ac419a7-dbeb-4727-83ab-7106d3e9ceb0" />

This setup feels a little bit magic to me, this becomes especially true when loading "other people's" gists, and I'm not sure how useful it is. If people really need this, they can easily make their own.



Discussion / hints:
Hi @bep 
Can I work on this
@manojks1999 any issue marked as "proposal" is not actionable.
> I'm not sure how useful it is

In all the sites I've looked at over the years, I have never seen it used.



Fix patch:
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/gist.html b/tpl/tplimpl/embedded/templates/shortcodes/gist.html
index 5f754f6514b..316d2d54ece 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/gist.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/gist.html
@@ -1,1 +1,2 @@
+{{- 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>


Test patch:
diff --git a/tpl/tplimpl/shortcodes_integration_test.go b/tpl/tplimpl/shortcodes_integration_test.go
index 7f560f53ae6..f3a5f7c1276 100644
--- a/tpl/tplimpl/shortcodes_integration_test.go
+++ b/tpl/tplimpl/shortcodes_integration_test.go
@@ -30,6 +30,9 @@ disableKinds = ['page','rss','section','sitemap','taxonomy','term']
 -- layouts/index.html --
 {{ .Content }}
 -- content/_index.md --
+---
+title: home
+---
 a{{< comment >}}b{{< /comment >}}c
 `
 
@@ -87,6 +90,26 @@ E: An _emphasized_ word.
 	)
 }
 
+func TestGistShortcode(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+-- layouts/index.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 TestInstagramShortcode(t *testing.T) {
 	t.Parallel()