20 KiB
date: 2018-10-29 title: "Hugo 0.50: Errors so Good, You’ll Want to Fail!" description: "Errors with full filename and line and column number, shown in browser. And improved Fast Render Mode …" categories: ["Releases"]
Hugo 0.50
brings greatly improved error messages, and we now also show them in the browser. Having error messages with filename, line- and column number greatly simplify troubleshooting. Many editors (like VS Code) even let you click and navigate directly to the problematic line. If your editor requires a different log format, you can set it via the HUGO_FILE_LOG_FORMAT
OS environment variable:
env HUGO_FILE_LOG_FORMAT="\":file::line::col\"" hugo server
But this release isn't all about error handling. Getting line- and column number into "every" error also meant that we had to consolidate and simplify some code paths, which, as a nice side effect, made Hugo a little bit faster. Benchmarks show it running about 5% faster and consume about 8% less memory.
Also, we have now implemented "render on demand" in Hugo's Fast Render Mode (default when running hugo server
). This means that you should now always see updated content when navigating around the site after a change.
This release represents 88 contributions by 14 contributors to the main Hugo code base. @bep leads the Hugo development with a significant amount of contributions, but also a big shoutout to @moorereason, @anthonyfok, and @GregorioMartinez for their ongoing contributions.
And a big thanks to @digitalcraftsman and @onedrawingperday for their relentless work on keeping the themes site in pristine condition and to @kaushalmodi for his great work on the documentation site.
Many have also been busy writing and fixing the documentation in hugoDocs, which has received 14 contributions by 9 contributors. A special thanks to @bep, @NotWoods, @Nick-Rivera, and @tomanistor for their work on the documentation site.
Hugo now has:
- 29842+ stars
- 441+ contributors
- 275+ themes
Notes
- You should not get stale content in Fast Render Mode anymore.
- Errors will now show up in the browser by default, turn it off by running
hugo server --disableBrowserError
jsonify
will now produce pretty/indented output
Enhancements
Templates
- Handle truncated identifiers in Go template errors 2d7709d1 @bep #5346
- Update Jsonify to return pretty-print output 5a52cd5f @SeanPrashad #5040
- Improve the Execute panic error message 0fe4ff18 @bep #5327
- Use .Lastmod in embedded schema template c21e5179 @akshaybabloo #5320
- Cast IsSet key to int for indexed types 0d5110d0 @moorereason #3681
- Add a delimiter parameter to lang.NumFmt ce264b93 @moorereason #5260
Core
- Adjust error test to make it pass on Go tip acc14b46 @bep
- Rename some page_* files e3ed4a83 @bep
- Get file context in "config parse failed" errors ed7b3e26 @bep #5325
- Improve errors in /i18n handlling 2bf686ee @bep #5324
- Improve errors in /data handlling 9f74dc2a @bep #5324
- Continue the file context/line number errors work d1661b82 @bep #5324
- Remove the now superflous Source struct 7930d213 @bep #5324
- Redo the summary delimiter logic 44da60d8 @bep #5324
- Integrate new page parser 1e3e3400 @bep #5324
- Use []byte in shortcode parsing 1b7ecfc2 @bep #5324
- Use stdlib context package 4b4af2c5 @GregorioMartinez
- Normalize permalink path segments fae48d74 @moorereason #5223#4926
- Improve error message for bad taxonomy weights d3b81ee5 @moorereason
- Cast taxonomy weight parameters to int 1fd30d46 @moorereason #4628
- Allow nil to be unwrapped as *Page 498d6299 @moorereason #5043
- Be a litle more specific in NextPage TODO fb732d53 @bep
- Introduce Page.NextPage and Page.PrevPage ad705aac @felicianotech #1061
Other
- Update go.sum 7082a5d1 @bep
- Update minify aa281b51 @bep #5261
- Regenerate CLI docs 32501987 @bep
- Make sure the global logger also gets colored labels 9c88a8a5 @bep #4414
- Avoid using the global logger 95e72f5e @bep #4414
- Add color to ERROR and WARN 1c7b7b4e @bep #4414
- Make the file error log format configurable 1ad117cb @bep #5352
- Allow a mix of slice types in append/Scratch.Add dac7092a @bep #5361
- Allow .Data.Integrity to be accessed on its own b27ccf34 @bep #5296
- Update minify 83c873ff @bep #5261
- Update cast a2440dc0 @bep #5340
- Truncate the error log on repeated config errors 1e9ac3dc @bep
- Regenerate CLI docs 40e99672 @bep #5354
- Serialize image processing 3a3badfd @bep #5220
- Only show Ansi escape codes if in a terminal df021317 @bep
- Read disableFastRender from flag even if it's not changed 78a4c2e3 @bep #5353
- Use overflow-x: auto; for browser errors d4ebfea1 @bep
- Remove the ANSI color for the browser error version 93aa6261 @bep
- Add some color to the relevant filenames in terminal log deff9e15 @bep #5344
- Run gofmt -s 889aca05 @bep
- Resolve error handling/parser related TODOs 6636cf1b @bep #5324
- Improve handling of JSON errors f669ef6b @bep #5324
- Convert the rest to new page parser code paths eb038cfa @bep #5324
- Consolidate the metadata decoders 129c27ee @bep #5324
- Use []byte in page lexer 27f5a906 @bep #5324
- Add front matter etc. support 2fdc4a24 @bep #5324
- File renames and splitting f6863e1e @bep #5324
- Move the shortcode parser to the new pageparser package d6c16afd @bep #5324
- Avoid panic in error handler on config errors 6f3716dc @bep
- Prevent stale content in Fast Render Mode 4a366fcf @bep #5281
- Allow date and slug from filename for leaf bundles 1f42e47e @Japanuspus #4558
- Show server error info in browser 35fbfb19 @bep #5284#5290#5325#5324
- Add .gitignore "hugo new site" 92979d92 @napei
- Optimize integrity string generation 0a3340e9 @moorereason
- Add help text to "hugo new" 6b21ac3e @elliotforbes
- Set "extended" tag based on build_url on Launchpad d1442053 @anthonyfok
- Call rst2html directly on *nix 3d4a9882 @shreyanshk
- Update URLs to stop 301 redirects bdca9727 @benabbottnz
- Merge branch 'release-0.49.2' 604ddb90 @bep
- Release 0.49.2 c397f2c0 @bep
- Merge branch 'release-0.49.1' 3583dd6d @bep
- Relase 0.49.1 235acf22 @bep
- Improve append in Scratch 23f48c30 @bep #5275
- Add GOPATH Hugo building tip b5e17f7c @bep
- Consolidate MakeSegment vs MakePathSanitized e421696d @bep #4926
- Render Markdown in figure shortcode "caption" and "attr" params 68181703 @kaushalmodi
- Re-organize the figure shortcode for better readability c5279064 @kaushalmodi
- Update README & CONTRIBUTING 152cffb1 @GregorioMartinez
- Add custom x-nodejs plugin to support ppc64el and s390x 91f49c07 @anthonyfok
- Fetch mage with GO111MODULE=off a475bf12 @anthonyfok
- Use build-snaps instead of building go from source fa873a6c @anthonyfok
- Skip "mage -v test" due to build failure on Launchpad 52ac85fb @anthonyfok
- Move snapcraft.yaml to snap/snapcraft.yaml 27d42111 @anthonyfok
- Update the temp docker script 48413d76 @bep
Fixes
Templates
- Fix baseof.html in error message 646a52a5 @bep #5288
- Fix handling of different interface types in Slice 10ac2ec4 @bep #5269
Core
- Fix test on Windows 083311d0 @bep
- Fix FuzzyWordCount test error message 06d28a46 @GregorioMartinez
Other
- Fix archetype handling of directories in theme 78578632 @bep #5318
- Simple doc fix in CONTRIBUTING.md 3a308912 @krisbudhram
- Fix type checking in Append 2159d77f @bep #5303
- Fix go plugin build failure by renaming go.mod 3033a9a3 @anthonyfok