Add site-level override for microformats/schema.html#4466
Merged
Conversation
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+.
tonyriv3
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.