Following the official installation instructions at https://theme-cards.hbstack.dev/docs/install-from-scratch/, the last step (npm run dev) fails with the following error when using Hugo ≥ v0.156.0:
huge: downloading modules …
hugo: collected modules in 87854 ms
ERROR "/home/myuser/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/hugomods/[email protected]/layouts/partials/giscus/repo-id.html:1:1": parse of template failed: template: _partials/giscus/repo-id.html:1: function "getJSON" not defined
Root cause
The getJSON template function was deprecated in Hugo v0.123.0 and permanently removed in Hugo v0.156.0 (see Hugo v0.156.0 release notes). The dependency github.com/hugomods/[email protected] still uses getJSON in layouts/partials/giscus/repo-id.html, which causes a hard parse error on Hugo ≥ v0.156.0.
Environment
- Hugo version: 0.157.0
- OS: Arch Linux
- Affected dependency:
github.com/hugomods/[email protected]
- Last known working Hugo version: 0.155.3
Steps to reproduce
- Follow the instructions at https://theme-cards.hbstack.dev/docs/install-from-scratch/
- Run
npm run dev (which runs hugo server --gc -D)
- Observe the error above
Expected behavior
hugo server starts without errors.
Suggested fix
The getJSON call in github.com/hugomods/giscus should be replaced with resources.GetRemote combined with transform.Unmarshal, as recommended by Hugo's migration guide. This may require updating the dependency on hugomods/giscus to a version that has already applied this fix, or patching it directly.
Reference: https://gohugo.io/functions/resources/getremote/
Following the official installation instructions at https://theme-cards.hbstack.dev/docs/install-from-scratch/, the last step (
npm run dev) fails with the following error when using Hugo ≥ v0.156.0:Root cause
The
getJSONtemplate function was deprecated in Hugo v0.123.0 and permanently removed in Hugo v0.156.0 (see Hugo v0.156.0 release notes). The dependencygithub.com/hugomods/[email protected]still usesgetJSONinlayouts/partials/giscus/repo-id.html, which causes a hard parse error on Hugo ≥ v0.156.0.Environment
github.com/hugomods/[email protected]Steps to reproduce
npm run dev(which runshugo server --gc -D)Expected behavior
hugo serverstarts without errors.Suggested fix
The
getJSONcall ingithub.com/hugomods/giscusshould be replaced withresources.GetRemotecombined withtransform.Unmarshal, as recommended by Hugo's migration guide. This may require updating the dependency onhugomods/giscusto a version that has already applied this fix, or patching it directly.Reference: https://gohugo.io/functions/resources/getremote/