Hugo Christmas Edition! | Hugo (0.62 Release)

https://gohugo.io/news/0.62.0-relnotes/

Hugo 0.62 brings Markdown Render Hooks. And it’s faster!

December 23, 2019

Go to Hugo Releases for the release downloads.

Featured Image for Hugo Christmas Edition!

From all of us to all of you, a very Merry Christmas – and Hugo 0.62.0 ! This version brings Markdown Render Hooks. This gives you full control over how links and images in Markdown are rendered without using any shortcodes. With this, you can get Markdown links that work on both GitHub and Hugo, resize images etc. It is a very long sought after feature, that has been hard to tackle until we got Goldmark, the new Markdown engine, by @yuin. When you read up on this new feature in the documentation, also note the new .RenderString method on Page .

Adding these render hooks also had the nice side effect of making Hugo faster and more memory effective . We could have just added this feature on top of what we got, getting it to work. But you like Hugo’s fast builds, you love instant browser-refreshes on change. So we had to take a step back and redesign how we detect “what changed?” for templates referenced from content files, either directly or indirectly. And by doing that we greatly simplified how we handle all the templates. Which accidentally makes this version the fastest to date . It’s not an “every site will be much faster” statement. This depends. Sites with many languages and/or many templates will benefit more from this. We have benchmarks with site-building showing about 15% improvement in build speed and memory efficiency.

This release represents 25 contributions by 5 contributors to the main Hugo code base. @bep leads the Hugo development with a significant amount of contributions, but also a big shoutout to @gavinhoward, @niklasfasching, and @zaitseff 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 8 contributions by 5 contributors . A special thanks to @bep, @DirtyF, @pfhawkins, and @bubelov for their work on the documentation site.

Also a big shoutout and thanks to the very active and helpful moderators on the Hugo Discourse, making it a first class forum for Hugo questions and discussions.

Hugo now has:

Notes

  • Ace and Amber support is now removed from Hugo. See #6609 for more information.
  • The markdownify template function does not, yet, support render hooks. We recommend you look at the new and more powerful .RenderString method on Page .
  • If you have output format specific behaviour in a template used from a content file, you must create a output format specific template, e.g. myshortcode.amp.html . This also applies to the new rendering hooks introduced in this release. This has been the intended behaviour all the time, but a failing test (now fixed) shows that the implementation of this has not been as strict as specified, hence this note.
  • The errorf does not return any value anymore. This means that the ERROR will just be printed to the console. We have also added a warnf template func.

Enhancements

Templates

Core

  • Improve error and reload handling of hook templates in server mode 8a58ebb3 @bep #6635

Other

Fixes

Templates

Core

Other

I’m reading the config examples and it’s pretty neat. I had wondered if I was going to one day put shortcodes into content, something I’d like to avoid for portability reasons. All the scenarios I considered, this new setting covers them!

Let’s see where I’m at, and what savings I can get on interi. :stuck_out_tongue_winking_eye:

First build of the day, and then one with caches refreshed:

[maiki@yuzu interi]$ hugo --templateMetrics
Building sites … 
Template Metrics:

     cumulative       average       maximum         
       duration      duration      duration  count  template
     ----------      --------      --------  -----  --------
   3.477674309s  579.612384ms  814.889754ms      6  qtq/single.html
   2.520573119s  1.260286559s  1.614550111s      2  warez/single.html
   421.690405ms  421.690405ms  421.690405ms      1  qtq/list.html
      469.337µs     469.337µs     469.337µs      1  _default/list.html
      217.104µs     217.104µs     217.104µs      1  index.html


                   | EN  
+------------------+----+
  Pages            | 11  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  0  
  Cleaned          |  0  

Total in 1918 ms
[maiki@yuzu interi]$ hugo --templateMetrics
Building sites … 
Template Metrics:

     cumulative       average       maximum         
       duration      duration      duration  count  template
     ----------      --------      --------  -----  --------
    12.321821ms    2.053636ms    2.850501ms      6  qtq/single.html
     4.817118ms    2.408559ms    2.721624ms      2  warez/single.html
     2.798197ms    2.798197ms    2.798197ms      1  qtq/list.html
      291.513µs     291.513µs     291.513µs      1  _default/list.html
      221.827µs     221.827µs     221.827µs      1  index.html


                   | EN  
+------------------+----+
  Pages            | 11  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  0  
  Cleaned          |  0  

Total in 10 ms

:sunglasses:

Hugo 0.62.1: A couple of Bug Fixes

This version fixes a couple of bugs introduced in 0.62.0.

January 1, 2020

Go to Hugo Releases for the release downloads.

This release is mainly motivated by getting this demo site up and running. It demonstrates truly portable Markdown links and images, whether browsed on GitHub or deployed as a Hugo site.

Hugo 0.62.2: A couple of Bug Fixes

This version fixes a couple of bugs introduced in 0.62.0.

January 5, 2020

Go to Hugo Releases for the release downloads.

The main driving force behind these patch releases in the new year has been getting a good story with portable links between GitHub and Hugo, using the new render hooks introduced in Hugo 0.62.0. And all was mostly well until a Hugo user asked about anchor links. Which is, when you look into it, a slightly sad Markdown story. They have been talking about anchors in Markdown over at the CommonMark forum for the last six years, but it has come to nothing. The current situation is that some Markdown engines support the {#anchorName} attribute syntax (Hugo’s Goldmark does, GitHub does not) and for those that support auto-generation of IDs, the implementation often varies. And this makes for poor portability.

To improve this, Hugo has now reverse-engineered GitHub’s implementation and made that the default strategy for generation or header IDs. We understand that this isn’t everyone’s cup of tea, so you can configure the behaviour to be one of github , github-ascii (some client-libraries have Unicode issues) or blackfriday (which will match how it behaved before Hugo 0.60).

We sure do talk about markdown a lot… :roll_eyes: