Future-dated blog posts in Hugo

Future-dated blog posts make daily or weekly blogging much more feasible, by allowing one to spontaneously create multiple posts made public over time. Another application is when reviewing embargoed topics, to be ready to deploy on release day. Use caution that the features being reviewed are actually in the release–I’ve seen software drop beta and even release candidate features in the public release.

Hugo is perhaps the fastest static website generator, which we prefer over Jekyll. Hugo can handle future-dated blog posts by simply regenerating the web page after the future blog post time has arrived. This can be done with a dummy Git commit and push, or triggering the build via the Netlify API control panel.

The config.yaml option for making future posts appear (which some might use for “pinning” a blog post) is:

buildFuture: true

Omitting that config.yaml option (default: buildFuture: false) allows future blog posts to appear on the desired date upon redeploy after the future post timestamp. To preview future posts on the local computer:

hugo server -F

-F == --buildFuture

The date / time of a Hugo blog post is typically set with the date: front matter variable. Note the publishDate: and expiryDate: variables for advanced usage. The lastmod: variable for last modified date HTML header can be implemented automatically in config.yaml:

enableGitInfo: true

The last modified date is for updates to a blog post without changing the original posted date of the article. The Git commit update time will thereby be in the article metadata, indicating the “freshness” of the article.

Hugo posts can be set as “draft”, normally not rendered for deployment by front matter variable draft: true. Future and draft posts can be listed from the top level Hugo project directory by:

hugo list future

hugo list drafts