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

hugo new content ignores the --format option #11462

Closed
jc-camosun opened this issue Sep 15, 2023 · 12 comments · Fixed by #11514
Closed

hugo new content ignores the --format option #11462

jc-camosun opened this issue Sep 15, 2023 · 12 comments · Fixed by #11514
Assignees

Comments

@jc-camosun
Copy link

What version of Hugo are you using (hugo version)?

0.118.2

Does this issue reproduce with the latest release?

yes

hugo new content --format yaml still produces +++ for the front matter instead of YAML's ---

@jmooring
Copy link
Member

Although this flag has been erroneously available when generating new content, it has never had any effect. The flag should be removed from the hugo new content command.

@jc-camosun
Copy link
Author

Although this flag has been erroneously available when generating new content, it has never had any effect. The flag should be removed from the hugo new content command.

If this is the case, how do you generate new content so that it uses YAML for its front matter if you have used --format yaml when generating the site?

@jmooring
Copy link
Member

You can have as many archetypes as you want, using different front matter formats, etc.

@jc-camosun
Copy link
Author

You can have as many archetypes as you want, using different front matter formats, etc.

That I understand, but if I used the --format yaml flag when generating the site with the hugo new site command, shouldn't the default.md also be in YAML, not TOML?

@jmooring
Copy link
Member

That flag only applies to the configuration format. That is the way it has always behaved.

@aquada
Copy link

aquada commented Oct 16, 2023

I am also interested in this. I have created the site with format YAML and it correctly creates a YAML config, but when I create a post it always defaults to TOML front matter. I have tried specifying metaDataFormat: yaml in the hugo.yaml, but it does not resolve the issue. How can we create content with YAML front matter?

@aquada
Copy link

aquada commented Oct 30, 2023

I am still confused as to how can we create content with YAML front matter? I can open another issue, but maybe there is a simple answer? As it stands it will always create TOML. thank you

@bep
Copy link
Member

bep commented Oct 30, 2023

I am still confused as to how can we create content with YAML front matter? I can open another issue, but maybe there is a simple answer? As it stands it will always create TOML. thank you

Content gets created based on archetype templates and Hugo will use whatever front matter format these uses.

@jtcmedia
Copy link

archetype templates

Might be a good idea for hugo to output to the console a message that you need to change your archetype templates to YAML manually when the user generates their site with --format yaml

@bep
Copy link
Member

bep commented Oct 30, 2023

@jtcmedia there is no such flag anymore for new content, so the user will get an error.

@aquada
Copy link

aquada commented Oct 30, 2023

I am still confused as to how can we create content with YAML front matter? I can open another issue, but maybe there is a simple answer? As it stands it will always create TOML. thank you

Content gets created based on archetype templates and Hugo will use whatever front matter format these uses.

that's clarified it, thank you

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 Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants