Hugo --minify failing

I use PaperMod theme, the hugo server -D works, all the pages are loading, but when I do minification, it fails, I checked the html files they had valid json’s in those specified lines. Here is a header of the .md file that is failing, maybe that would give an idea. Although I removed all the content from the pages, to see if it’s from the content, and it still failed.

+++

title = ‘Generating functions’

description = “Introduction to generating functions and their applications in combinatorics”

date = 2024-05-12T13:26:47+02:00

tags = [“Math”, “Combinatorics”]

draft = false

+++

Here are the logs.
❯ hugo --gc --minify
Start building sites …
hugo v0.125.7+extended darwin/arm64 BuildDate=2024-05-08T14:46:24Z VendorInfo=brew

ERROR failed to process “/blog/introduction/index.html”: “/var/folders/sm/z5kfpmtd5pvd31nc2605hs0h0000gn/T/hugo-transform-error2460583693:89:40”: expected comma character or an array or object ending on line 89 and column 40
12: {
^
ERROR failed to process “/blog/matroids/index.html”: “/var/folders/sm/z5kfpmtd5pvd31nc2605hs0h0000gn/T/hugo-transform-error1141656666:89:40”: expected comma character or an array or object ending on line 89 and column 40
12: {
^
Total in 36 ms
Error: error building site: render: failed to render pages: failed to process “/blog/generatingfunctions/index.html”: “/var/folders/sm/z5kfpmtd5pvd31nc2605hs0h0000gn/T/hugo-transform-error3043238659:86:40”: expected comma character or an array or object ending on line 86 and column 40
12: {
^
did anyone had similar issues?

Without access to the JS this is impossible to troubleshoot.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

Here is my code
GitHub - jantiks/devo-blog

I also added changes in _default/baseoff.html to support Katex

{{- if lt hugo.Version "0.112.4" }}
{{- errorf "=> hugo v0.112.4 or greater is required for hugo-PaperMod to build " }}
{{- end -}}

<!DOCTYPE html>
<html lang="{{ site.Language }}" dir="{{ .Language.LanguageDirection | default "auto" }}">

<head>
    {{- partial "head.html" . }}
    {{ if .Param "math" }}
        {{ partialCached "math.html" . }}
    {{ end }}
</head>

<body class="
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
{{- print "list" -}}
{{- end -}}
{{- if eq site.Params.defaultTheme `dark` -}}
{{- print " dark" }}
{{- end -}}
" id="top">
    {{- partialCached "header.html" . .Page -}}
    <main class="main">
        {{- block "main" . }}{{ end }}
    </main>
    {{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}}
</body>

</html>

And in partials I have the math.html

Thank you for helping.

Please contact the theme author. This code…

…is rendering this:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position":  1 ,
      "name": "Blogs",
      "item": "/blog/"
    }  <-------------------------- NEED A COMMA HERE
    {
      "@type": "ListItem",
      "position":  1 ,
      "name": "What is a Matroid?",
      "item": "/blog/matroids/"
    }
  ]
}
</script>

It looks like this PR is supposed to fix the problem:
https://github.com/adityatelange/hugo-PaperMod/pull/1471

Thank you very much, this fixed my issue

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.