Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Garbled TOML archetype parsing in hugo new #2745

Closed
bep opened this issue Nov 28, 2016 · 7 comments
Closed

Garbled TOML archetype parsing in hugo new #2745

bep opened this issue Nov 28, 2016 · 7 comments
Milestone

Comments

@bep
Copy link
Member

bep commented Nov 28, 2016

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

@bep bep added the Bug label Nov 28, 2016
@bep bep added this to the v0.18 milestone Nov 28, 2016
@bep bep self-assigned this Nov 28, 2016
@bep bep changed the title Garbled TOML archetype parsing Garbled TOML archetype parsing in hugo new Nov 28, 2016
@kaushalmodi
Copy link
Contributor

I have been seeing this too (on v0.17 too). The TOML front matter always comes up in random order.

@bep
Copy link
Member Author

bep commented Nov 28, 2016

@kaushalmodi ordering of the TOML isn't this issue, but #452 -- and, btw, it isn't random, the order is undefined. Which is different.

@kaushalmodi
Copy link
Contributor

@bep Thanks. I realize that I already had commented on that issue thread too.

@moorereason
Copy link
Contributor

This may be fixed by pelletier/go-toml#111

bep added a commit that referenced this issue Nov 28, 2016
@bep bep removed their assignment Nov 28, 2016
@bep
Copy link
Member Author

bep commented Nov 28, 2016

I have updated go-toml, would be cool if someone could test it out.

@bep
Copy link
Member Author

bep commented Nov 28, 2016

This looks to be working fine with the latest Hugo.

@bep bep closed this as completed Nov 28, 2016
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants