Dive into the Hugo v0.27 Release

Posted on

Hugo v0.27 has been released today. Let’s dive into what’s new, get links to download, and more.

What’s New?

The crown jewel of the Hugo v0.27 release is the ability to generate related content via Hugo. If you use Hugo to build a blog (this very website for example) then the ability to show related blog posts at the bottom of your current post is extremely useful. This helps keep readers engaged and on your website by surfacing older content they would enjoy but might not otherwise find.

Example usage:

{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h3>See Also</h3>
	{{ range . }}
	<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
	{{ end }}
{{ end }}

Calculate Time Duration

Hugo has introduced two new functions to work with displaying the time between two timestamps. time.Duration and time.ParseDuration are now template functions.

Ternary Function Support

A new template function has been added to support “ternary conditions”. This means that in addition to use ge, gt, le, etc to compare two arguments, you can now use conditional as a ternary operation.

Built on CircleCI 2.0

Wanting to take advantage of CircleCI 2.0’s “Manual Approval” Jobs, Hugo is now being built on CircleCI 2.0.

Multiple Config File Support

Due to support for chaining multiple configuration files landing in Viper, Hugo itself now supports chaining config files.

Install Hugo

Via Package Manager

  • Apt - apt-get install hugo note: Typically older versions
  • SnapCraft - snap install hugo
  • Brew - brew install hugo

Via Download

Via Docker

Hugo can be used locally and in a Continuous Integration (CI) environment via the “Docker Hugo” Docker image:

A blog post on how to use this image can be found below.

More options are available on the GitHub Release Page.

More Information

comments powered by Disqus