From c19416931547effe4486d4d508363f1f91199547 Mon Sep 17 00:00:00 2001 From: Hyacinthe Cartiaux Date: Sat, 27 Jul 2024 08:15:56 +0200 Subject: [PATCH] Fix various deprecation warning (#113) * .Site.IsServer was deprecated in Hugo v0.120.0, replaced by hugo.IsServer * .Site.DisqusShortname was deprecated in Hugo v0.120.0, replaced by .Site.Config.Services.Disqus.Shortname * Use .RenderString instead of markdownify (solves #104) * The "tweet" shortcode requires two named parameters user and id. * Replace .Site.BaseURL by absURL (solves #103) --- exampleSite/content/posts/post-6.md | 2 +- layouts/_default/single.html | 2 +- layouts/index.html | 2 +- layouts/partials/disqus.html | 4 ++-- layouts/partials/footer.html | 2 +- layouts/partials/head.html | 4 ++-- layouts/partials/header.html | 10 +++++----- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/exampleSite/content/posts/post-6.md b/exampleSite/content/posts/post-6.md index 0a29764..da32634 100644 --- a/exampleSite/content/posts/post-6.md +++ b/exampleSite/content/posts/post-6.md @@ -21,7 +21,7 @@ description: Here is a demo of all shortcodes available in Hugo. ## Tweet -{{< tweet 877500564405444608 >}} +{{< tweet user="GoHugoIO" id="877500564405444608" >}} ## Vimeo diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0e96234..6a30c8f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -30,7 +30,7 @@ {{- $.Scratch.Set "isDisqus" true -}} - {{ if not .Site.DisqusShortname }} + {{ if not .Site.Config.Services.Disqus.Shortname }} {{- $.Scratch.Set "isDisqus" false -}} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index bd4d1da..746d9f1 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -8,7 +8,7 @@
{{- if isset .Site.Params "subtitle" -}} -

{{ .Site.Params.Subtitle | markdownify }}

+

{{ .Site.Params.Subtitle | .Page.RenderString }}

{{- end -}}
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html index 11bd488..8ab0447 100644 --- a/layouts/partials/disqus.html +++ b/layouts/partials/disqus.html @@ -9,11 +9,11 @@ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; - var disqus_shortname = '{{ .Site.DisqusShortname }}'; + var disqus_shortname = '{{ .Site.Config.Services.Disqus.Shortname }}'; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); -comments powered by Disqus \ No newline at end of file +comments powered by Disqus diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index b84cd91..c685b05 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -10,7 +10,7 @@ href="https://github.com/athul/archie">Archie Theme | Built with Hugo -{{ if not .Site.IsServer }} +{{ if not hugo.IsServer }} {{ template "_internal/google_analytics.html" . }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 30476c8..462b93d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,6 +1,6 @@
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index ad3ae4c..b5cd99b 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -25,7 +25,7 @@ {{ if and (isset .Site.Params "social") (.Site.Params.useCDN | default false) -}} {{- else if or (isset .Site.Params "social") (eq .Site.Params.mode "toggle") -}} - + {{ end }} {{ if .Site.Params.useCDN | default false -}} @@ -49,7 +49,7 @@ - + - + {{ end }} - + {{- if isset .Site.Params "customcss" }} {{ range .Site.Params.customCSS }} @@ -98,7 +98,7 @@ {{- else if (hasPrefix . " + {{- end }} {{- end }}