Repository: gohugoio/hugo (language: go)

Issue:
Fix context issue with some embedded templates
Reference: <https://discourse.gohugo.io/t/problems-with-0-141-0-and-tweet-x-embed/53170/10>


Discussion / hints:

Fix patch:
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/qr.html b/tpl/tplimpl/embedded/templates/shortcodes/qr.html
index 818f6656df2..05e8dbde999 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/qr.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/qr.html
@@ -9,7 +9,7 @@
 @param {string} [class] The class attribute of the img element.
 @param {string} [id] The id attribute of the img element.
 @param {string} [title] The title attribute of the img element.
-@param {string} [loading] The loading attribute of the img element, one of lazy, or eager. 
+@param {string} [loading] The loading attribute of the img element, one of lazy or eager.
 
 @returns {template.HTML}
 
@@ -49,7 +49,6 @@
 {{- $title := or (.Get "title") "" }}
 {{- $loading := or (.Get "loading") "" }}
 
-
 {{- /* Validate arguments. */}}
 {{- $errors := false}}
 {{- if not $text }}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/twitter.html b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
index 7a4adea5d34..ce356559d36 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
@@ -1,5 +1,5 @@
 {{- warnf "The \"twitter\", \"tweet\", and \"twitter_simple\" shortcodes were deprecated in v0.142.0 and will be removed in a future release. Please use the \"x\" shortcode instead." }}
-{{- $pc := .Page.Site.Config.Privacy.Twitter -}}
+{{- $pc := site.Config.Privacy.Twitter -}}
 {{- if not $pc.Disable -}}
   {{- if $pc.Simple -}}
     {{- template "_internal/shortcodes/twitter_simple.html" . -}}
@@ -7,7 +7,7 @@
     {{- $id := or (.Get "id") "" -}}
     {{- $user := or (.Get "user") "" -}}
     {{- if and $id $user -}}
-      {{- template "render-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "name" .Name "position" .Position) -}}
+      {{- template "render-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "ctx" .) -}}
     {{- else -}}
       {{- errorf "The %q shortcode requires two named parameters: user and id. See %s" .Name .Position -}}
     {{- end -}}
@@ -24,7 +24,7 @@
     {{- else with .Value -}}
       {{- (. | transform.Unmarshal).html | safeHTML -}}
     {{- else -}}
-    {{- warnidf "shortcode-twitter-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" .name .position -}}
+      {{- warnidf "shortcode-twitter-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
     {{- end -}}
   {{- end -}}
 {{- end -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html b/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html
index 7251f64e31f..e9dcc76ba98 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html
@@ -23,7 +23,7 @@
       {{- end }}
       {{- (. | transform.Unmarshal).html | safeHTML -}}
     {{- else -}}
-      {{- warnidf "shortcode-twitter-simple-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" .ctx.Name .ctx.Position -}}
+      {{- warnidf "shortcode-twitter-simple-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
     {{- end -}}
   {{- end -}}
 {{- end -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html b/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html
index 8ddad9b43b5..b3fc781a394 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/vimeo.html
@@ -1,4 +1,4 @@
-{{- $pc := .Page.Site.Config.Privacy.Vimeo -}}
+{{- $pc := site.Config.Privacy.Vimeo -}}
 {{- if not $pc.Disable -}}
 {{- if $pc.Simple -}}
 {{ template "_internal/shortcodes/vimeo_simple.html" . }}
@@ -11,4 +11,4 @@
 </div>
 {{ end }}
 {{- end -}}
-{{- end -}}
\ No newline at end of file
+{{- end -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/vimeo_simple.html b/tpl/tplimpl/embedded/templates/shortcodes/vimeo_simple.html
index 7f7940b804d..11f19b1f6f3 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/vimeo_simple.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/vimeo_simple.html
@@ -1,6 +1,6 @@
-{{- $pc := .Page.Site.Config.Privacy.Vimeo -}}
+{{- $pc := site.Config.Privacy.Vimeo -}}
 {{- if not $pc.Disable -}}
-  {{- $ctx := dict "page" .Page "pc" $pc "name" .Name "position" .Position }}
+  {{- $ctx := dict "ctx" . }}
   {{- if .IsNamedParams -}}
     {{- with .Get "id" -}}
       {{- $ctx = merge $ctx (dict "id" . "class" ($.Get "class")) -}}
@@ -19,7 +19,7 @@
 {{- end -}}
 
 {{- define "render-vimeo" -}}
-  {{- $dnt := cond .pc.EnableDNT 1 0 -}}
+  {{- $dnt := cond site.Config.Privacy.Vimeo.EnableDNT 1 0 -}}
   {{- $url := urls.JoinPath "https://vimeo.com" .id -}}
   {{- $query := querify "url" $url "dnt" $dnt -}}
   {{- $request := printf "https://vimeo.com/api/oembed.json?%s" $query -}}
@@ -32,7 +32,7 @@
         {{- with $.class -}}
           {{- $class = printf "%s %s" "s_video_simple" . -}}
         {{- else -}}
-          {{ template "__h_simple_css" $.page }}
+          {{ template "__h_simple_css" $.ctx.Page }}
         {{- end -}}
         {{- $thumbnail := .thumbnail_url -}}
         {{- $original := $thumbnail | replaceRE "(_.*\\.)" "." -}}
@@ -40,13 +40,13 @@
           <a href="{{ .provider_url }}{{ .video_id }}" rel="noopener" target="_blank">
             <img src="{{ $thumbnail }}" srcset="{{ $thumbnail }} 1x, {{ $original }} 2x" alt="{{ .title }}">
             <div class="play">
-              {{ template "__h_simple_icon_play" $.page }}
+              {{ template "__h_simple_icon_play" $.ctx.Page }}
             </div>
           </a>
         </div>
       {{- end -}}
     {{- else -}}
-      {{- warnidf "shortcode-vimeo-simple" "The %q shortcode was unable to retrieve the remote data. See %s" .name .position -}}
+      {{- warnidf "shortcode-vimeo-simple" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
     {{- end -}}
   {{- end -}}
 {{- end -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/x.html b/tpl/tplimpl/embedded/templates/shortcodes/x.html
index 78c0ac08bca..28a5e331b91 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/x.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/x.html
@@ -1,4 +1,4 @@
-{{- $pc := .Page.Site.Config.Privacy.X -}}
+{{- $pc := site.Config.Privacy.X -}}
 {{- if not $pc.Disable -}}
   {{- if $pc.Simple -}}
     {{- template "_internal/shortcodes/x_simple.html" . -}}
@@ -6,7 +6,7 @@
     {{- $id := or (.Get "id") "" -}}
     {{- $user := or (.Get "user") "" -}}
     {{- if and $id $user -}}
-      {{- template "render-x" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "name" .Name "position" .Position) -}}
+      {{- template "render-x" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "ctx" .) -}}
     {{- else -}}
       {{- errorf "The %q shortcode requires two named parameters: user and id. See %s" .Name .Position -}}
     {{- end -}}
@@ -23,7 +23,7 @@
     {{- else with .Value -}}
       {{- (. | transform.Unmarshal).html | safeHTML -}}
     {{- else -}}
-    {{- warnidf "shortcode-x-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" .name .position -}}
+      {{- warnidf "shortcode-x-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
     {{- end -}}
   {{- end -}}
 {{- end -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/x_simple.html b/tpl/tplimpl/embedded/templates/shortcodes/x_simple.html
index 661ed77560b..be7830668b5 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/x_simple.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/x_simple.html
@@ -22,7 +22,7 @@
       {{- end }}
       {{- (. | transform.Unmarshal).html | safeHTML -}}
     {{- else -}}
-      {{- warnidf "shortcode-x-simple-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" .ctx.Name .ctx.Position -}}
+      {{- warnidf "shortcode-x-simple-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
     {{- end -}}
   {{- end -}}
 {{- end -}}


Test patch:
diff --git a/tpl/tplimpl/shortcodes_integration_test.go b/tpl/tplimpl/shortcodes_integration_test.go
new file mode 100644
index 00000000000..d9c540cd9a3
--- /dev/null
+++ b/tpl/tplimpl/shortcodes_integration_test.go
@@ -0,0 +1,330 @@
+// Copyright 2025 The Hugo Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package tplimpl_test
+
+import (
+	"strings"
+	"testing"
+
+	"github.com/gohugoio/hugo/htesting/hqt"
+	"github.com/gohugoio/hugo/hugolib"
+)
+
+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>")
+}
+
+func TestDetailsShortcode(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+-- layouts/index.html --
+{{ .Content }}
+-- content/_index.md --
+---
+title: home
+---
+{{< details >}}
+A: An _emphasized_ word.
+{{< /details >}}
+
+{{< details
+  class="my-class"
+  name="my-name"
+  open=true
+  summary="A **bold** word"
+  title="my-title"
+>}}
+B: An _emphasized_ word.
+{{< /details >}}
+
+{{< details open=false >}}
+C: An _emphasized_ word.
+{{< /details >}}
+
+{{< details open="false" >}}
+D: An _emphasized_ word.
+{{< /details >}}
+
+{{< details open=0 >}}
+E: An _emphasized_ word.
+{{< /details >}}
+`
+	b := hugolib.Test(t, files)
+
+	b.AssertFileContent("public/index.html",
+		"<details>\n  <summary>Details</summary>\n  <p>A: An <em>emphasized</em> word.</p>\n</details>",
+		"<details class=\"my-class\" name=\"my-name\" open title=\"my-title\">\n  <summary>A <strong>bold</strong> word</summary>\n  <p>B: An <em>emphasized</em> word.</p>\n</details>",
+		"<details>\n  <summary>Details</summary>\n  <p>C: An <em>emphasized</em> word.</p>\n</details>",
+		"<details>\n  <summary>Details</summary>\n  <p>D: An <em>emphasized</em> word.</p>\n</details>",
+		"<details>\n  <summary>Details</summary>\n  <p>D: An <em>emphasized</em> word.</p>\n</details>",
+	)
+}
+
+func TestInstagramShortcode(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+privacy.instagram.simple = false
+-- content/_index.md --
+---
+title: home
+---
+{{< instagram CxOWiQNP2MO >}}
+-- layouts/index.html --
+Hash: {{ .Content | hash.XxHash }}
+Content: {{ .Content }}
+`
+
+	// Regular mode
+	b := hugolib.Test(t, files)
+	b.AssertFileContent("public/index.html", "a7937c49665872d3")
+
+	// Simple mode
+	files = strings.ReplaceAll(files, "privacy.instagram.simple = false", "privacy.instagram.simple = true")
+	b = hugolib.Test(t, files)
+	b.AssertFileContent("public/index.html", "2c1dce3881be0513")
+}
+
+func TestQRShortcode(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+-- layouts/index.html --
+{{ .Content }}
+-- content/_index.md --
+---
+title: home
+---
+{{< qr
+	text="https://gohugo.io"
+	level="high"
+	scale=4
+	targetDir="codes"
+	alt="QR code linking to https://gohugo.io"
+	class="my-class"
+	id="my-id"
+	title="My Title"
+/>}}
+
+{{< qr >}}
+https://gohugo.io"
+{{< /qr >}}
+`
+
+	b := hugolib.Test(t, files)
+
+	b.AssertFileContent("public/index.html",
+		`<img src="/codes/qr_be5d263c2671bcbd.png" width="148" height="148" alt="QR code linking to https://gohugo.io" class="my-class" id="my-id" title="My Title">`,
+		`<img src="/qr_472aab57ec7a6e3d.png" width="132" height="132">`,
+	)
+}
+
+func TestVimeoShortcode(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+privacy.vimeo.simple = false
+-- content/_index.md --
+---
+title: home
+---
+{{< vimeo 55073825 >}}
+-- layouts/index.html --
+Hash: {{ .Content | hash.XxHash }}
+Content: {{ .Content }}
+`
+
+	// Regular mode
+	b := hugolib.Test(t, files)
+	b.AssertFileContent("public/index.html", "d5b2a079cc37d0ed")
+
+	// Simple mode
+	files = strings.ReplaceAll(files, "privacy.vimeo.simple = false", "privacy.vimeo.simple = true")
+	b = hugolib.Test(t, files)
+	b.AssertFileContent("public/index.html", "73b8767ce8bdf694")
+
+	// Simple mode with non-existent id
+	files = strings.ReplaceAll(files, "{{< vimeo 55073825 >}}", "{{< vimeo __id_does_not_exist__ >}}")
+	b = hugolib.Test(t, files, hugolib.TestOptWarn())
+	b.AssertLogContains(`WARN  The "vimeo" shortcode was unable to retrieve the remote data.`)
+}
+
+// Issue 13214
+// We deprecated the twitter, tweet (alias of twitter), and twitter_simple
+// shortcodes in v0.141.0, replacing them with x and x_simple.
+func TestXShortcodes(t *testing.T) {
+	t.Parallel()
+
+	files := `
+-- hugo.toml --
+disableKinds = ['home','rss','section','sitemap','taxonomy','term']
+#CONFIG
+-- content/p1.md --
+---
+title: p1
+---
+{{< x user="SanDiegoZoo" id="1453110110599868418" >}}
+-- content/p2.md --
+---
+title: p2
+---
+{{< twitter user="SanDiegoZoo" id="1453110110599868418" >}}
+-- content/p3.md --
+---
+title: p3
+---
+{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
+-- content/p4.md --
+---
+title: p4
+---
+{{< x_simple user="SanDiegoZoo" id="1453110110599868418" >}}
+-- content/p5.md --
+---
+title: p5
+---
+{{< twitter_simple user="SanDiegoZoo" id="1453110110599868418" >}}
+-- layouts/_default/single.html --
+{{ .Content | strings.TrimSpace | safeHTML }}
+--
+`
+
+	b := hugolib.Test(t, files)
+
+	// Test x, twitter, and tweet shortcodes
+	want := `<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Owl bet you&#39;ll lose this staring contest 🦉 <a href="https://t.co/eJh4f2zncC">pic.twitter.com/eJh4f2zncC</a></p>&mdash; San Diego Zoo Wildlife Alliance (@sandiegozoo) <a href="https://twitter.com/sandiegozoo/status/1453110110599868418?ref_src=twsrc%5Etfw">October 26, 2021</a></blockquote>
+	<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`
+	b.AssertFileContent("public/p1/index.html", want)
+
+	htmlFiles := []string{
+		b.FileContent("public/p1/index.html"),
+		b.FileContent("public/p2/index.html"),
+		b.FileContent("public/p3/index.html"),
+	}
+
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	// Test x_simple and twitter_simple shortcodes
+	wantSimple := "<style type=\"text/css\">\n      .twitter-tweet {\n        font:\n          14px/1.45 -apple-system,\n          BlinkMacSystemFont,\n          \"Segoe UI\",\n          Roboto,\n          Oxygen-Sans,\n          Ubuntu,\n          Cantarell,\n          \"Helvetica Neue\",\n          sans-serif;\n        border-left: 4px solid #2b7bb9;\n        padding-left: 1.5em;\n        color: #555;\n      }\n      .twitter-tweet a {\n        color: #2b7bb9;\n        text-decoration: none;\n      }\n      blockquote.twitter-tweet a:hover,\n      blockquote.twitter-tweet a:focus {\n        text-decoration: underline;\n      }\n    </style><blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">Owl bet you&#39;ll lose this staring contest 🦉 <a href=\"https://t.co/eJh4f2zncC\">pic.twitter.com/eJh4f2zncC</a></p>&mdash; San Diego Zoo Wildlife Alliance (@sandiegozoo) <a href=\"https://twitter.com/sandiegozoo/status/1453110110599868418?ref_src=twsrc%5Etfw\">October 26, 2021</a></blockquote>\n--"
+	b.AssertFileContent("public/p4/index.html", wantSimple)
+
+	htmlFiles = []string{
+		b.FileContent("public/p4/index.html"),
+		b.FileContent("public/p5/index.html"),
+	}
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	filesOriginal := files
+
+	// Test privacy.twitter.simple
+	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.twitter.simple=true")
+	b = hugolib.Test(t, files)
+	htmlFiles = []string{
+		b.FileContent("public/p2/index.html"),
+		b.FileContent("public/p3/index.html"),
+		b.FileContent("public/p5/index.html"),
+	}
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	// Test privacy.x.simple
+	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.x.simple=true")
+	b = hugolib.Test(t, files)
+	htmlFiles = []string{
+		b.FileContent("public/p1/index.html"),
+		b.FileContent("public/p4/index.html"),
+		b.FileContent("public/p4/index.html"),
+	}
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	htmlFiles = []string{
+		b.FileContent("public/p2/index.html"),
+		b.FileContent("public/p3/index.html"),
+	}
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	// Test privacy.twitter.disable
+	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.twitter.disable = true")
+	b = hugolib.Test(t, files)
+	b.AssertFileContent("public/p1/index.html", "")
+	htmlFiles = []string{
+		b.FileContent("public/p1/index.html"),
+		b.FileContent("public/p2/index.html"),
+		b.FileContent("public/p3/index.html"),
+		b.FileContent("public/p4/index.html"),
+		b.FileContent("public/p4/index.html"),
+	}
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	// Test privacy.x.disable
+	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.x.disable = true")
+	b = hugolib.Test(t, files)
+	b.AssertFileContent("public/p1/index.html", "")
+	htmlFiles = []string{
+		b.FileContent("public/p1/index.html"),
+		b.FileContent("public/p4/index.html"),
+	}
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	htmlFiles = []string{
+		b.FileContent("public/p2/index.html"),
+		b.FileContent("public/p3/index.html"),
+	}
+	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
+
+	// Test warnings
+	files = `
+-- hugo.toml --
+disableKinds = ['page','rss','section','sitemap','taxonomy','term']
+-- content/_index.md --
+---
+title: home
+---
+{{< x user="__user_does_not_exist__" id="__id_does_not_exist__" >}}
+{{< x_simple user="__user_does_not_exist__" id="__id_does_not_exist__" >}}
+{{< twitter user="__user_does_not_exist__" id="__id_does_not_exist__" >}}
+{{< twitter_simple user="__user_does_not_exist__" id="__id_does_not_exist__" >}}
+-- layouts/index.html --
+{{ .Content }}
+`
+
+	b = hugolib.Test(t, files, hugolib.TestOptWarn())
+	b.AssertLogContains(
+		`WARN  The "x" shortcode was unable to retrieve the remote data.`,
+		`WARN  The "x_simple" shortcode was unable to retrieve the remote data.`,
+		`WARN  The "twitter", "tweet", and "twitter_simple" shortcodes were deprecated in v0.142.0 and will be removed in a future release.`,
+		`WARN  The "twitter" shortcode was unable to retrieve the remote data.`,
+		`WARN  The "twitter_simple" shortcode was unable to retrieve the remote data.`,
+	)
+}
diff --git a/tpl/tplimpl/tplimpl_integration_test.go b/tpl/tplimpl/tplimpl_integration_test.go
index d1e214ce26f..9b30466e8c7 100644
--- a/tpl/tplimpl/tplimpl_integration_test.go
+++ b/tpl/tplimpl/tplimpl_integration_test.go
@@ -6,7 +6,6 @@ import (
 	"testing"
 
 	qt "github.com/frankban/quicktest"
-	"github.com/gohugoio/hugo/htesting/hqt"
 	"github.com/gohugoio/hugo/hugolib"
 	"github.com/gohugoio/hugo/tpl"
 )
@@ -586,71 +585,6 @@ title: p5
 	)
 }
 
-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>")
-}
-
-func TestDetailsShortcode(t *testing.T) {
-	t.Parallel()
-
-	files := `
--- hugo.toml --
-disableKinds = ['page','rss','section','sitemap','taxonomy','term']
--- layouts/index.html --
-{{ .Content }}
--- content/_index.md --
----
-title: home
----
-{{< details >}}
-A: An _emphasized_ word.
-{{< /details >}}
-
-{{< details
-  class="my-class"
-  name="my-name"
-  open=true
-  summary="A **bold** word"
-  title="my-title"
->}}
-B: An _emphasized_ word.
-{{< /details >}}
-
-{{< details open=false >}}
-C: An _emphasized_ word.
-{{< /details >}}
-
-{{< details open="false" >}}
-D: An _emphasized_ word.
-{{< /details >}}
-
-{{< details open=0 >}}
-E: An _emphasized_ word.
-{{< /details >}}
-`
-	b := hugolib.Test(t, files)
-
-	b.AssertFileContent("public/index.html",
-		"<details>\n  <summary>Details</summary>\n  <p>A: An <em>emphasized</em> word.</p>\n</details>",
-		"<details class=\"my-class\" name=\"my-name\" open title=\"my-title\">\n  <summary>A <strong>bold</strong> word</summary>\n  <p>B: An <em>emphasized</em> word.</p>\n</details>",
-		"<details>\n  <summary>Details</summary>\n  <p>C: An <em>emphasized</em> word.</p>\n</details>",
-		"<details>\n  <summary>Details</summary>\n  <p>D: An <em>emphasized</em> word.</p>\n</details>",
-		"<details>\n  <summary>Details</summary>\n  <p>D: An <em>emphasized</em> word.</p>\n</details>",
-	)
-}
-
 // Issue 12963
 func TestEditBaseofParseAfterExecute(t *testing.T) {
 	files := `
@@ -699,162 +633,3 @@ Home!
 	b.BuildPartial("/mybundle1/")
 	b.AssertFileContent("public/mybundle1/index.html", "Baseof!!")
 }
-
-func TestQRShortcode(t *testing.T) {
-	t.Parallel()
-
-	files := `
--- hugo.toml --
-disableKinds = ['page','rss','section','sitemap','taxonomy','term']
--- layouts/index.html --
-{{ .Content }}
--- content/_index.md --
----
-title: home
----
-{{< qr
-	text="https://gohugo.io"
-	level="high"
-	scale=4
-	targetDir="codes"
-	alt="QR code linking to https://gohugo.io"
-	class="my-class"
-	id="my-id"
-	title="My Title"
-/>}}
-
-{{< qr >}}
-https://gohugo.io"
-{{< /qr >}}
-`
-
-	b := hugolib.Test(t, files)
-
-	b.AssertFileContent("public/index.html",
-		`<img src="/codes/qr_be5d263c2671bcbd.png" width="148" height="148" alt="QR code linking to https://gohugo.io" class="my-class" id="my-id" title="My Title">`,
-		`<img src="/qr_472aab57ec7a6e3d.png" width="132" height="132">`,
-	)
-}
-
-// Issue 13214
-// We deprecated the twitter, tweet (alias of twitter), and twitter_simple
-// shortcodes in v0.141.0, replacing them with x and x_simple.
-func TestXShortcodes(t *testing.T) {
-	t.Parallel()
-
-	files := `
--- hugo.toml --
-disableKinds = ['home','rss','section','sitemap','taxonomy','term']
-#CONFIG
--- content/p1.md --
----
-title: p1
----
-{{< x user="SanDiegoZoo" id="1453110110599868418" >}}
--- content/p2.md --
----
-title: p2
----
-{{< twitter user="SanDiegoZoo" id="1453110110599868418" >}}
--- content/p3.md --
----
-title: p3
----
-{{< tweet user="SanDiegoZoo" id="1453110110599868418" >}}
--- content/p4.md --
----
-title: p4
----
-{{< x_simple user="SanDiegoZoo" id="1453110110599868418" >}}
--- content/p5.md --
----
-title: p5
----
-{{< twitter_simple user="SanDiegoZoo" id="1453110110599868418" >}}
--- layouts/_default/single.html --
-{{ .Content | strings.TrimSpace | safeHTML }}
---
-`
-
-	b := hugolib.Test(t, files)
-
-	// Test x, twitter, and tweet shortcodes
-	want := `<blockquote class="twitter-tweet"><p lang="en" dir="ltr">Owl bet you&#39;ll lose this staring contest 🦉 <a href="https://t.co/eJh4f2zncC">pic.twitter.com/eJh4f2zncC</a></p>&mdash; San Diego Zoo Wildlife Alliance (@sandiegozoo) <a href="https://twitter.com/sandiegozoo/status/1453110110599868418?ref_src=twsrc%5Etfw">October 26, 2021</a></blockquote>
-	<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`
-	b.AssertFileContent("public/p1/index.html", want)
-
-	htmlFiles := []string{
-		b.FileContent("public/p1/index.html"),
-		b.FileContent("public/p2/index.html"),
-		b.FileContent("public/p3/index.html"),
-	}
-
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-
-	// Test x_simple and twitter_simple shortcodes
-	wantSimple := "<style type=\"text/css\">\n      .twitter-tweet {\n        font:\n          14px/1.45 -apple-system,\n          BlinkMacSystemFont,\n          \"Segoe UI\",\n          Roboto,\n          Oxygen-Sans,\n          Ubuntu,\n          Cantarell,\n          \"Helvetica Neue\",\n          sans-serif;\n        border-left: 4px solid #2b7bb9;\n        padding-left: 1.5em;\n        color: #555;\n      }\n      .twitter-tweet a {\n        color: #2b7bb9;\n        text-decoration: none;\n      }\n      blockquote.twitter-tweet a:hover,\n      blockquote.twitter-tweet a:focus {\n        text-decoration: underline;\n      }\n    </style><blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">Owl bet you&#39;ll lose this staring contest 🦉 <a href=\"https://t.co/eJh4f2zncC\">pic.twitter.com/eJh4f2zncC</a></p>&mdash; San Diego Zoo Wildlife Alliance (@sandiegozoo) <a href=\"https://twitter.com/sandiegozoo/status/1453110110599868418?ref_src=twsrc%5Etfw\">October 26, 2021</a></blockquote>\n--"
-	b.AssertFileContent("public/p4/index.html", wantSimple)
-
-	htmlFiles = []string{
-		b.FileContent("public/p4/index.html"),
-		b.FileContent("public/p5/index.html"),
-	}
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-
-	filesOriginal := files
-
-	// Test privacy.twitter.simple
-	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.twitter.simple=true")
-	b = hugolib.Test(t, files)
-	htmlFiles = []string{
-		b.FileContent("public/p2/index.html"),
-		b.FileContent("public/p3/index.html"),
-		b.FileContent("public/p5/index.html"),
-	}
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-
-	// Test privacy.x.simple
-	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.x.simple=true")
-	b = hugolib.Test(t, files)
-	htmlFiles = []string{
-		b.FileContent("public/p1/index.html"),
-		b.FileContent("public/p4/index.html"),
-		b.FileContent("public/p4/index.html"),
-	}
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-
-	htmlFiles = []string{
-		b.FileContent("public/p2/index.html"),
-		b.FileContent("public/p3/index.html"),
-	}
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-
-	// Test privacy.twitter.disable
-	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.twitter.disable = true")
-	b = hugolib.Test(t, files)
-	b.AssertFileContent("public/p1/index.html", "")
-	htmlFiles = []string{
-		b.FileContent("public/p1/index.html"),
-		b.FileContent("public/p2/index.html"),
-		b.FileContent("public/p3/index.html"),
-		b.FileContent("public/p4/index.html"),
-		b.FileContent("public/p4/index.html"),
-	}
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-
-	// Test privacy.x.disable
-	files = strings.ReplaceAll(filesOriginal, "#CONFIG", "privacy.x.disable = true")
-	b = hugolib.Test(t, files)
-	b.AssertFileContent("public/p1/index.html", "")
-	htmlFiles = []string{
-		b.FileContent("public/p1/index.html"),
-		b.FileContent("public/p4/index.html"),
-	}
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-
-	htmlFiles = []string{
-		b.FileContent("public/p2/index.html"),
-		b.FileContent("public/p3/index.html"),
-	}
-	b.Assert(htmlFiles, hqt.IsAllElementsEqual)
-}