Skip to content

Add site-level override for microformats/schema.html#4466

Merged
tonyriv3 merged 1 commit into13.0from
fix-minification-errors-13.0
Mar 7, 2026
Merged

Add site-level override for microformats/schema.html#4466
tonyriv3 merged 1 commit into13.0from
fix-minification-errors-13.0

Conversation

@DjP-iX
Copy link
Contributor

@DjP-iX DjP-iX commented Mar 6, 2026

Hugo 0.157.0 now applies JSON context-aware escaping inside <script type="application/ld+json"> tags during template rendering. This broke the geekdoc theme's schema.html partial, which used string interpolation ("{{ . }}") directly inside the script tag — causing Hugo to insert extra "" boundaries and produce invalid JSON that the minifier then rejected.

The fix overrides the theme partial in each site's layouts/ directory. Instead of building the JSON-LD object through string interpolation inside the script tag, the override constructs the schema using Hugo's dict function and encodes it with jsonify before the script tag is output. Since jsonify returns template.HTML, the result bypasses context-sensitive escaping entirely, producing valid JSON that the minifier accepts.

This fix is required for any site built with --minify on Hugo 0.157.0+.

Thanks for contributing to TrueNAS documentation! By opening a Pull Request, you're acknowledging that your changes will be distributed under the Creative Commons 4.0 license.

Hugo 0.157.0 now applies JSON context-aware escaping inside <script type="application/ld+json"> tags during template rendering. This broke the geekdoc theme's schema.html partial, which used string interpolation ("{{ . }}") directly inside the script tag — causing Hugo to insert extra "" boundaries and produce invalid JSON that the minifier then rejected.

The fix overrides the theme partial in each site's layouts/ directory. Instead of building the JSON-LD object through string interpolation inside the script tag, the override constructs the schema using Hugo's dict function and encodes it with jsonify before the script tag is output. Since jsonify returns template.HTML, the result bypasses context-sensitive escaping entirely, producing valid JSON that the minifier accepts.

This fix is required for any site built with --minify on Hugo 0.157.0+.
@DjP-iX DjP-iX requested a review from a team as a code owner March 6, 2026 21:25
@tonyriv3 tonyriv3 merged commit 2a2fd33 into 13.0 Mar 7, 2026
2 checks passed
@tonyriv3 tonyriv3 deleted the fix-minification-errors-13.0 branch March 7, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants