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 · 6 comments

Comments

Projects
None yet
3 participants
@bep
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 from Garbled TOML archetype parsing to Garbled TOML archetype parsing in hugo new Nov 28, 2016

@kaushalmodi

This comment has been minimized.

Show comment
Hide comment
@kaushalmodi

kaushalmodi Nov 28, 2016

Member

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

Member

kaushalmodi commented Nov 28, 2016

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

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Nov 28, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@kaushalmodi

kaushalmodi Nov 28, 2016

Member

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

Member

kaushalmodi commented Nov 28, 2016

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

@moorereason

This comment has been minimized.

Show comment
Hide comment
@moorereason

moorereason Nov 28, 2016

Contributor

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

Contributor

moorereason commented Nov 28, 2016

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

This comment has been minimized.

Show comment
Hide comment
@bep

bep Nov 28, 2016

Member

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

Member

bep commented Nov 28, 2016

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

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Nov 28, 2016

Member

This looks to be working fine with the latest Hugo.

Member

bep commented Nov 28, 2016

This looks to be working fine with the latest Hugo.

@bep bep closed this Nov 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment