Skip to content

[BUG] Minified build errors with: expected comma character or an array or object ending on line... #1441

@pierreprinetti

Description

@pierreprinetti

Describe the bug
I am getting this error when running hugo --minify:

Error: error building site: render: failed to render pages: failed to process "/posts/2024-02-27_reproducer/index.html": "/tmp/hugo-transform-error250503843:83:40": expected comma character or an array or object ending on line 83 and column 40
   12:     {
           ^

and indeed the tempfile has a scheme.org JSON array with two elements and no comma between them:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position":  1 ,
      "name": "Posts",
      "item": "/posts/"
    }
    {
      "@type": "ListItem",
      "position":  1 ,
      "name": "This is a reproducer for a PaperMod bug",
      "item": "/posts/2024-02-27_reproducer/"
    }
  ]
}
</script>

I am not sure what triggers the error. Anyway, I could build a reproducer (see below).

  • Device/Os: N/A
  • Type: N/A
  • Browser and version: N/A
  • Hugo Version: 0.123.6
  • Theme Version: commit 55b2eb4

Steps to reproduce the behavior:

  1. Create a minimal post
  2. Generate a minified build
  3. enjoy

Expected behavior:
I expected the site to build, just like it does when no --minify is passed.

Repo/Source where this issue can be reproduced:

cd $(mktemp -d)
git clone --recurse-submodules git@github.com:pierreprinetti/papermod-bug-reproducer.git .
hugo --minify

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions