Skip to content

Commit

Permalink
Fix various deprecation warning (athul#113)
Browse files Browse the repository at this point in the history
* .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 athul#104)

* The "tweet" shortcode requires two named parameters user and id.

* Replace .Site.BaseURL by absURL (solves athul#103)
  • Loading branch information
hcartiaux authored Jul 27, 2024
1 parent a1ecb22 commit c194169
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion exampleSite/content/posts/post-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ description: Here is a demo of all shortcodes available in Hugo.

## Tweet

{{< tweet 877500564405444608 >}}
{{< tweet user="GoHugoIO" id="877500564405444608" >}}

## Vimeo

Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">{{ .Title }}</h1>
</div>
{{- $.Scratch.Set "isDisqus" true -}}
<!-- Check if disqus short name is given -->
{{ if not .Site.DisqusShortname }}
{{ if not .Site.Config.Services.Disqus.Shortname }}
{{- $.Scratch.Set "isDisqus" false -}}
{{ end }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<main class="list">
<div class="site-description">
{{- if isset .Site.Params "subtitle" -}}
<p>{{ .Site.Params.Subtitle | markdownify }}</p>
<p>{{ .Site.Params.Subtitle | .Page.RenderString }}</p>
{{- end -}}
</div>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/disqus.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by
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>
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
href="https://github.com/athul/archie">Archie Theme</a> | Built with <a href="https://gohugo.io">Hugo</a>
</div>
</footer>
{{ if not .Site.IsServer }}
{{ if not hugo.IsServer }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}

Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<header>
<div class="main">
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
<a href="{{ absURL "/" }}">{{ .Site.Title }}</a>
</div>
<nav>
{{ range .Site.Menus.main }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
{{ if eq .Site.Params.mode "toggle" -}}
| <span id="dark-mode-toggle" onclick="toggleTheme()"></span>
<script src="{{ .Site.BaseURL }}js/themetoggle.js"></script>
<script src="{{ absURL "js/themetoggle.js" }}"></script>
{{ end }}
</nav>
</header>
10 changes: 5 additions & 5 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{ 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>
{{- 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 }}
{{ 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">
Expand All @@ -49,7 +49,7 @@
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

<!-- inline Mathjax -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand All @@ -71,7 +71,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script>

<!-- inline KaTeX -->
<script>
document.addEventListener("DOMContentLoaded", function() {
Expand All @@ -84,7 +84,7 @@
});
</script>
{{ end }}

<!-- Custom CSS style get applied last -->
{{- if isset .Site.Params "customcss" }}
{{ range .Site.Params.customCSS }}
Expand All @@ -98,7 +98,7 @@
{{- else if (hasPrefix . "<script")}}
{{ .| safeHTML }}
{{- else }}
<script src="{{ $.Site.BaseURL }}{{ . }}"></script>
<script src="{{ absURL . }}"></script>
{{- end }}
{{- end }}
</head>

0 comments on commit c194169

Please sign in to comment.