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)
This commit is contained in:
Hyacinthe Cartiaux 2024-07-27 08:15:56 +02:00 committed by GitHub
parent a1ecb22846
commit c194169315
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 13 additions and 13 deletions

View file

@ -21,7 +21,7 @@ description: Here is a demo of all shortcodes available in Hugo.
## Tweet ## Tweet
{{< tweet 877500564405444608 >}} {{< tweet user="GoHugoIO" id="877500564405444608" >}}
## Vimeo ## Vimeo

View file

@ -30,7 +30,7 @@
</div> </div>
{{- $.Scratch.Set "isDisqus" true -}} {{- $.Scratch.Set "isDisqus" true -}}
<!-- Check if disqus short name is given --> <!-- Check if disqus short name is given -->
{{ if not .Site.DisqusShortname }} {{ if not .Site.Config.Services.Disqus.Shortname }}
{{- $.Scratch.Set "isDisqus" false -}} {{- $.Scratch.Set "isDisqus" false -}}
{{ end }} {{ end }}

View file

@ -8,7 +8,7 @@
<main class="list"> <main class="list">
<div class="site-description"> <div class="site-description">
{{- if isset .Site.Params "subtitle" -}} {{- if isset .Site.Params "subtitle" -}}
<p>{{ .Site.Params.Subtitle | markdownify }}</p> <p>{{ .Site.Params.Subtitle | .Page.RenderString }}</p>
{{- end -}} {{- end -}}
</div> </div>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}

View file

@ -9,11 +9,11 @@
var dsq = document.createElement('script'); var dsq = document.createElement('script');
dsq.type = 'text/javascript'; dsq.type = 'text/javascript';
dsq.async = true; dsq.async = true;
var disqus_shortname = '{{ .Site.DisqusShortname }}'; var disqus_shortname = '{{ .Site.Config.Services.Disqus.Shortname }}';
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})(); })();
</script> </script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by
Disqus.</a></noscript> Disqus.</a></noscript>
<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> <a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

View file

@ -10,7 +10,7 @@
href="https://github.com/athul/archie">Archie Theme</a> | Built with <a href="https://gohugo.io">Hugo</a> href="https://github.com/athul/archie">Archie Theme</a> | Built with <a href="https://gohugo.io">Hugo</a>
</div> </div>
</footer> </footer>
{{ if not .Site.IsServer }} {{ if not hugo.IsServer }}
{{ template "_internal/google_analytics.html" . }} {{ template "_internal/google_analytics.html" . }}
{{ end }} {{ end }}

View file

@ -1,6 +1,6 @@
<header> <header>
<div class="main"> <div class="main">
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> <a href="{{ absURL "/" }}">{{ .Site.Title }}</a>
</div> </div>
<nav> <nav>
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
@ -8,7 +8,7 @@
{{ end }} {{ end }}
{{ if eq .Site.Params.mode "toggle" -}} {{ if eq .Site.Params.mode "toggle" -}}
| <span id="dark-mode-toggle" onclick="toggleTheme()"></span> | <span id="dark-mode-toggle" onclick="toggleTheme()"></span>
<script src="{{ .Site.BaseURL }}js/themetoggle.js"></script> <script src="{{ absURL "js/themetoggle.js" }}"></script>
{{ end }} {{ end }}
</nav> </nav>
</header> </header>

View file

@ -25,7 +25,7 @@
{{ if and (isset .Site.Params "social") (.Site.Params.useCDN | default false) -}} {{ if and (isset .Site.Params "social") (.Site.Params.useCDN | default false) -}}
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
{{- else if or (isset .Site.Params "social") (eq .Site.Params.mode "toggle") -}} {{- else if or (isset .Site.Params "social") (eq .Site.Params.mode "toggle") -}}
<script src="{{ .Site.BaseURL }}js/feather.min.js"></script> <script src="{{ absURL "js/feather.min.js" }}"></script>
{{ end }} {{ end }}
{{ if .Site.Params.useCDN | default false -}} {{ if .Site.Params.useCDN | default false -}}
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap" rel="stylesheet">
@ -49,7 +49,7 @@
<script type="text/javascript" <script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script> </script>
<!-- inline Mathjax --> <!-- inline Mathjax -->
<script type="text/x-mathjax-config"> <script type="text/x-mathjax-config">
MathJax.Hub.Config({ MathJax.Hub.Config({
@ -71,7 +71,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.js"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script>
<!-- inline KaTeX --> <!-- inline KaTeX -->
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
@ -84,7 +84,7 @@
}); });
</script> </script>
{{ end }} {{ end }}
<!-- Custom CSS style get applied last --> <!-- Custom CSS style get applied last -->
{{- if isset .Site.Params "customcss" }} {{- if isset .Site.Params "customcss" }}
{{ range .Site.Params.customCSS }} {{ range .Site.Params.customCSS }}
@ -98,7 +98,7 @@
{{- else if (hasPrefix . "<script")}} {{- else if (hasPrefix . "<script")}}
{{ .| safeHTML }} {{ .| safeHTML }}
{{- else }} {{- else }}
<script src="{{ $.Site.BaseURL }}{{ . }}"></script> <script src="{{ absURL . }}"></script>
{{- end }} {{- end }}
{{- end }} {{- end }}
</head> </head>