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 uses toml frontmatter in archetypes/default.md even when site was created with --format yaml #12922

Closed
ajbuz opened this issue Oct 10, 2024 · 3 comments

Comments

@ajbuz
Copy link

ajbuz commented Oct 10, 2024

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

I think version is irreverent here since it exists from beginning ?

$ hugo version
hugo v0.135.0+extended linux/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes

Steps to Reproduce

hugo new site --format yaml my-new-site
cat  my-new-site/archetypes/default.md
+++
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
date = {{ .Date }}
draft = true
+++

Expected output

---
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
date: {{ .Date }}
draft: true
---
@bep
Copy link
Member

bep commented Oct 10, 2024

I think version is irreverent here since it exists from beginning ?

No it hasn't, but this has been discussed before and is as designed. Hugo uses the front matter templates in the archetype files as-is, there's no YAML to toml conversion. If you want TOML, create archetype files with TOML

@bep bep closed this as completed Oct 10, 2024
@ajbuz
Copy link
Author

ajbuz commented Oct 10, 2024

there's no YAML to toml conversion. If you want TOML, create archetype files with TOML

I don't know if you understood my question or not. What I'm trying to say is I want YAML not TOML in the frontmatter of archtypes/default.md like this

---
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
date: {{ .Date }}
draft: true
---

when I create site using hugo new site --format yaml my-new-site command.

But its giving me this

+++
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
date = {{ .Date }}
draft = true
+++

@jmooring
Copy link
Member

Duplicate of #12666

@jmooring jmooring marked this as a duplicate of #12666 Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants