Skip to content

failed to transform mermaid.js at jsonify #1321

@multun

Description

@multun

Hello there! While testing a patch, I found out that the website I'm working on (which only uses docsy) does not build anymore on the development branch. I use the latest docker-hugo with ext-alpine and a submodule workflow.

I ran a bisect and found out this error only happens since 90843e3 (from #990, by @stephanlachnit)

Symptoms

This warning (always)

.Path when the page is backed by a file is deprecated and will be removed in a future release. We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct similar to the one below:

  {{ $path := "" }}
  {{ with .File }}
	{{ $path = .Path }}
  {{ else }}
	{{ $path = .Path }}
  {{ end }}

This error (when there's a rebuild server running)

Rebuild failed: EXECUTE-AS-TEMPLATE: failed to transform "js/mermaid.js" (text/javascript) at <jsonify>: error calling jsonify: json: error calling MarshalJSON for type page.Page: unsupported type: func() page.Pages

And when building from scratch, I get an horribly long strack overflow trace which recursively loops on page.MarshalPageToJSON / MarshalJSON

Reproducer

# get the site source
git clone --recurse-submodules git@github.com:DGEXSolutions/osrd-website.git
cd osrd-website
# checkout the failing revision
(cd themes/docsy; git reset --hard 90843e360b921ea8417995e0261a355f2f3aed7a)
# npm install dependencies
docker run --rm -it -v $(pwd):/src -w /src/themes/docsy --entrypoint npm klakegg/hugo:ext-alpine install
# build the thing
docker run --rm -it -v $(pwd):/src -p 1313:1313 klakegg/hugo:ext-alpine server

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions