Add JSON to --minify

Hi all,

I recently added some ld+json type strucutred data to a site that gets built running hugo --minify.

After the build process, I noticed that --minify seems to ignore the JSON, leaving it as it came from the partial its defined in.

It would be great, if hugo --minify would also support the minification of JSON, as running JSON filled with things like {{ .Site.Params.author }} through any online minifiers doesn’t seem feasible because they interpret that as syntax errors.

Sorry if I missed something here, but I didn’t find anything on that subject using the search here.

Looks like “ld+json” mimetypes should already be minified if the “application” type is set to those correctly.

There’s a test in Hugo that verifies that “ld+json” minification works:

It must have been late yesterday, just found the reason:

I was using Hugo 0.49.2 locally, while the netlify.toml file was still requesting 0.47.

Changing that just some minutes ago, Netlify built a site with minified ld+json data - just as expected.

Sorry for that, this topic should probably be closed and moved to support now… :roll_eyes:

1 Like