hugo 0.19 snap package fails to write config.toml and TOML front matter properly

Created on 24 Mar 2017  路  6Comments  路  Source: gohugoio/hugo

As reported by Ian Barton at https://discuss.gohugo.io/t/creating-new-post-doesnt-add-default-front-matter/5875, when tested on Arch Linux, the current hugo 0.19 snap package does not add a proper front matter to a new Markdown post generated with hugo new:

When I create a new post it only contains:

+++

+++

i.e. no date, draft and title. I presume I have missed a configuration option somewhere, but can't see what it is.

I can produce this regression in the hugo 0.19 snap (revision 34 for amd64) on my Debian sid too.
The hugo 0.18.1 snap (revision 29 for amd64), on the other hand, generates all TOML contents correctly.

Not only that, it turns out hugo new site generates an empty config.toml file with no TOML entries inside!

What about YAML and JSON? They both work perfectly fine, generating perfect config.yaml or config.json, as well as proper front matters for new posts, when tested with --format=yaml and --format=json for hugo new site and hugo new (post) commands.

So, problem is TOML-specific, but why, and how?

Bug

All 6 comments

Many thanks to @bep and all who have already encountered and fixed the same problem:

  • Latest go-toml breaks Hugo: pelletier/go-toml#137
  • Investigate go-toml issues: #3147
  • Latest go-toml doesn't work: #3142

The problem with our snap is that the snap does not yet do any vendoring.

TODO: Build hugo snap with vendoring.

The problem with our snap is that the snap does not yet do any vendoring.

That I didn't know. That is a big gotcha. So the Snap users are basically getting something completely different ...? And I don't think Hugo works out-of-the box with the latest go-toml, so we should somehow disable Snap until we have that fixed.

And I don't think Hugo works out-of-the box with the latest go-toml...

You are right, and a straight re-compile of hugo wouldn't work either without vendoring:

so we should somehow disable Snap until we have that fixed.

Great idea! I have "unpublished" hugo 0.19 from the Ubuntu snap store, so end users will get the older but working hugo 0.18.1 if they were to install hugo snap for the first time.

Meanwhile, I am starting to learn how to change snapcraft.yaml to run make vendor instead of its built-in rules, and will have a fix ready and uploaded, hopefully in several hours.

The Hugo v0.19 snap is now back in working order, starting with Rev 39 (amd64) and Rev 40 (i386).

Thanks for that. I find snaps useful when I want to try something out quickly and not leave stuff all over my computer if I uninstall.

Thanks for that. I find snaps useful when I want to try something out quickly and not leave stuff all over my computer if I uninstall.

Thank you for bringing the bug to my attention, as otherwise I would have completely missed it.

And it was about time that the Hugo snap be updated to support vendoring. It has been in the back of my mind for quite a while now, and finally there is an impetus to actually do it. :-) Thank you @ianbarton!

Was this page helpful?
0 / 5 - 0 ratings