Skip to content

Garbled TOML archetype parsing in hugo new #2745

@bep

Description

@bep

See https://discuss.gohugo.io/t/hugo-new-command-scrambles-front-matter/4682

Probably an issue with the new TOML lib. We should report it there, but a fix for this is more likely a proper fix for #452 -- which we may just have to do now.


I spent some time working out a good set of archetypes, with menu entries placed last.
However, "hugo new " scrambles the order of the fields badly.

For example, I have a review archetype:

+++
tags = ["review", "opinion"]
categories = ["reviews"]
type = "page"
[menu.main]
weight = 99
name = "menu name"
parent="parentid"
+++

If I run "hugo new page/writing/new_story.md" and then look at the file, it looks like this:

+++

categories
= ["reviews", ]
parent = "parentid'
[menu.main]
type = "page"
tags = ["review", "opinion"]

+++

Sometimes it is worse.

Any ideas?

Probably related to

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions