From 540da40a3b5af2a31e155c64f56138e8801b7cd3 Mon Sep 17 00:00:00 2001
From: Alexander Bilz <mail@alexbilz.com>
Date: Thu, 18 Jul 2024 16:10:48 +0000
Subject: [PATCH] fix: deprecation warnings for Twitter, Google Analytics and Disqus

---
 .devcontainer/Dockerfile                         |    2 +-
 layouts/_default/single.html                     |    2 +-
 exampleSite/content/english/post/rich-content.md |    2 +-
 exampleSite/config/_default/config.toml          |   12 ++++++++----
 layouts/partials/footer.html                     |    2 +-
 5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 960e283..ba42825 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -3,7 +3,7 @@
 FROM mcr.microsoft.com/devcontainers/javascript-node:${NODE_VERSION}
 
 # VARIANT can be either 'hugo' for the standard version or 'hugo_extended' for the extended version.
-ARG VARIANT=hugo
+ARG VARIANT=hugo_extended
 # VERSION can be either 'latest' or a specific version number
 ARG VERSION=latest
 
diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml
index f39e07e..890025d 100644
--- a/exampleSite/config/_default/config.toml
+++ b/exampleSite/config/_default/config.toml
@@ -12,11 +12,7 @@
 enableEmoji = true
 enableRobotsTXT = true
 
-# Enable Disqus
-#disqusShortname = ""
 
-# Google Analytics
-#googleAnalytics = "UA-123-45"
 
 # Syntax highlighting
 pygmentsUseClasses = true   
@@ -46,3 +42,11 @@
 [[related.indices]]
   name = 'tags'
   weight = 80
+
+[services]
+# Enable Disqus.Disqus.Shortname
+  [services.disqus]
+    #shortname = 'your-disqus-shortname'
+# Google Analytics
+  [services.googleAnalytics]
+    #ID = 'G-MEASUREMENT_ID'
diff --git a/exampleSite/content/english/post/rich-content.md b/exampleSite/content/english/post/rich-content.md
index f091773..8026978 100644
--- a/exampleSite/content/english/post/rich-content.md
+++ b/exampleSite/content/english/post/rich-content.md
@@ -23,7 +23,7 @@
 
 ## Twitter Simple Shortcode
 
-{{< twitter_simple 1085870671291310081 >}}
+{{< twitter user="SanDiegoZoo" id="1453110110599868418" >}}
 
 <br>
 
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index acaad3f..f09fd30 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -77,7 +77,7 @@
     </div>
 
     {{ if and (or (eq .Type "post") (eq .Type .Site.Params.postSectionName)) (ne .Page.Params.disableComments true) }}
-      {{- if .Site.DisqusShortname -}}
+      {{- if .Site.Config.Services.Disqus.Shortname -}}
         <div id="comment">
           <h2>{{ i18n "comments" }}</h2>
           {{ template "_internal/disqus.html" . }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index e3f6ed5..ba2de22 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -27,7 +27,7 @@
 </footer>
 {{- partial "medium-zoom.html" .context -}}
 {{- partial "math.html" .context -}}
-{{- if (hasPrefix .context.Site.GoogleAnalytics "G-") -}}
+{{- if (hasPrefix .context.Site.Config.Services.GoogleAnalytics.ID "G-") -}}
   {{- template "_internal/google_analytics.html" .context -}}
 {{- end -}}
 {{- if and (hugo.IsProduction) (.context.Site.Params.gtagId) -}}

--
Gitblit v1.10.0