HUGO

Hugo new will create an invalid "draft"

Like this:
hugo new posts/world.md

---
title: "World"
date: 2021-05-11T14:47:49+08:00 draft: true
---
$ hugo server
hugo: collected modules in 598 ms
Start building sites …
Built in 2 ms
Error: Error building site: "C:\Users\U\JetBrains\GoLandProjects\yoooo.fun\content\posts\world.md:3:1": failed to unmarshal YAML: yaml: line 2: mapping values are not allowed in this context

I know moving the draft to the next line will work again.
However, if I create a new one, it will still reoccur.
Could anyone help it? Thanks a lot.

try to have 1 line for each param. Like this on your /archetype/default.md file:

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

hello, divinerites

I know it, however, it will reoccur when I create a new one.

I had edited my response in the mean time. Is it better ?

Yep, it works fine. Thank you very much. :grinning:

OK. So you can flag it as “response”, for other people

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.