mirror of https://github.com/luizdepra/hugo-coder.git

Andreas Deininger
25.38.2024 7551142f3a44c8036f64637f753f4fcde2c308af
Fix deprecation warning emitted by hugo (#903)

When running example site with latest hugo version 0.124.1, a
deprecation warning is shown:

```
INFO deprecated: .Site.DisqusShortname was deprecated in Hugo v0.120.0 and will be removed in a future release. Use .Site.Config.Services.Disqus.Shortname instead.
```

This PR fixes that warning.

Co-authored-by: Luiz F. A. de PrĂ¡ <luizdepra@users.noreply.github.com>
4 files modified
1 files renamed
15 ■■■■■ changed files
docs/configurations.md 2 ●●●●● patch | view | raw | blame | history
docs/quick-start.md 2 ●●● patch | view | raw | blame | history
exampleSite/hugo.toml 5 ●●●● patch | view | raw | blame | history
layouts/partials/posts/disqus.html 4 ●●●● patch | view | raw | blame | history
netlify.toml 2 ●●● patch | view | raw | blame | history
docs/configurations.md
@@ -258,6 +258,8 @@
paginate = 20
[services]
[services.disqus]
disqusShortname = "yourdiscussshortname"
[markup.highlight]
docs/quick-start.md
@@ -3,7 +3,7 @@
To start using `hugo-coder`:
1. Add the repository into your Hugo Project repository as a submodule, `git submodule add https://github.com/luizdepra/hugo-coder.git themes/coder`.
2. Configure your `config.toml`. You can use [this minimal configuration](https://github.com/luizdepra/hugo-coder/blob/main/docs/configurations.md#complete-example) as a base. The [`config.toml`](https://github.com/luizdepra/hugo-coder/blob/master/exampleSite/config.toml) inside the [exampleSite](https://github.com/luizdepra/hugo-coder/tree/master/exampleSite) from the `exampleSite` is also a good reference.
2. Configure your `config.toml`. You can use [this minimal configuration](https://github.com/luizdepra/hugo-coder/blob/main/docs/configurations.md#complete-example) as a base. The [`hugo.toml`](https://github.com/luizdepra/hugo-coder/blob/master/exampleSite/hugo.toml) inside the [exampleSite](https://github.com/luizdepra/hugo-coder/tree/master/exampleSite) from the `exampleSite` is also a good reference.
3. Build your site with `hugo serve` and see the result at `http://localhost:1313/`.
If you just want to test this theme, go to [this page](https://themes.gohugo.io/themes/hugo-coder/).
exampleSite/hugo.toml
File was renamed from exampleSite/config.toml
@@ -5,8 +5,11 @@
defaultContentLanguage = "en"
paginate = 6
enableEmoji = true
[services]
[services.disqus]
# Enable Disqus comments
# disqusShortname = "yourdiscussshortname"
# shortname = "yourdiscussshortname"
[markup.highlight]
noClasses = false
layouts/partials/posts/disqus.html
@@ -1,4 +1,4 @@
{{- if and (not (eq (.Site.DisqusShortname | default "") "")) (eq (.Params.disableComments | default false) false) -}}
{{- if and (not (eq (.Site.Config.Services.Disqus.Shortname | default "") "")) (eq (.Params.disableComments | default false) false) -}}
<div id="disqus_thread"></div>
<script>
  window.disqus_config = function () {
@@ -12,7 +12,7 @@
            return;
        }
        var d = document, s = d.createElement('script'); s.async = true;
        s.src = '//' + {{ .Site.DisqusShortname }} + '.disqus.com/embed.js';
        s.src = '//' + {{ .Site.Config.Services.Disqus.Shortname }} + '.disqus.com/embed.js';
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
netlify.toml
@@ -3,7 +3,7 @@
command = "cd exampleSite && hugo --themesDir=../.. --baseURL $URL"
[build.environment]
HUGO_VERSION = "0.111.3"
HUGO_VERSION = "0.124.1"
HUGO_THEME = "repo"
[context.deploy-preview]