[Solved] Creating New Post Doesn't Add Default Front Matter (Snap, v0.19, TOML)

I have just started using Hugo, so apologies if this is obvious to everyone but me! I have installed hugo using snap and am following the “Quick Start”. 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.

you need to add Archetypes.

like so:

create file default.md in archetypes folder.

Add your default frontmatter to it:

+++
layout = "post"
categories = [""]
title = ""
subtitle = ""
+++

Thanks, but that didn’t work:)

Even without a default archetype, Hugo should still create title, date, and draft values in the front matter. Are you creating new content files with the command line, e.g. hugo new my-fantastic-content.md? Which version of Hugo are you using?

Can you link to your repo?

EDIT: Check out these docs on archetypes.

Yes, I am using the command line as per the “Quick Start”. I am fairly certain that I am using 0.19: it’s whatever is contained in the snap package. It might be a problem with the snap package. I am having problems installing hugo on Arch using the AUR package, so thought I would try snap. I’ll see if I can fix the problem with the AUR and try installing that tomorrow.

Thanks for the help. Off to bed now!

As soon as you said you were having issues with snap, I thought, “Yeah, I have no way to provide this person with any help at all.”

@anthonyfok - can you provide any guidance?

1 Like

I have sorted out the installation problem on Arch and have installed Hugo using the AUR. I can confirm that it now works as expected. So, the problem seems to have been snap. Thanks to everyone for their help.

1 Like

Thank you for the heads up, @rdwatters!

@Ian_Barton, sorry for the trouble that you have experienced with the Snap package of Hugo 0.19, though I am very glad that you have problem sorted out by installing Hugo using the AUR on Arch Linux.

And thank you for your report! You have found a bug in the hugo 0.19 snap (revision 34 for amd64) that isn’t in the hugo 0.18.1 snap (revision 29 for amd64). A regression?

And it turns out to be TOML-specific. Other formats, namely YAML and JSON, are not affected by this bug.

For anyone who is interested, this bug may be tracked here:
https://github.com/spf13/hugo/issues/3226

1 Like

I am happy to report that the Hugo v0.19 snap is now back in working order, starting with Rev 39 (amd64) and Rev 40 (i386). The other three platforms are waiting to be built, see status here: https://launchpad.net/~foka/+snap/hugo

2 Likes