Trying to start the Hugo server, I keep getting this error: Error: Error building site: "/Users/me/hugo/content/posts/2011/01/many-thanks.md:4:1": failed to unmarshal YAML: yaml: line 3: did not find expected key
Line 3 is the date. I’ve checked it against other pages, have tried quoting (str) and no quotes (date), commenting and deleting that line but the error message is quite persistent. Where else is Hugo looking this up? Other pages with similar date formats work. Puzzling. Thanks.
It might be just an artifact of the forum here but it looks like you have ‘smart’ quotes rather than straight quotes in that example. Could that be the problem?
Amusingly, I removed the date and title lines from the .md file, tried to run the server again and got the same error.
hugo server -D
Total in 30 ms
Error: Error building site: "/Users/maya/hugo/content/posts/2011/01/many-thanks.md:2:1": failed to unmarshal YAML: yaml: line 1: did not find expected key
The file, as all other files, starts with three dashes and was set up using Hugo new filename command.
---
title: "Many Thanks"
date: 2019-02-03T22:13:30-08:00
draft: true
tags: "process"
categories: "history"
---
Date published: 2011-01-13 at 16:13:04 PST
Body of this post goes here.
Thanks @zwbetz - that’s the offending header. The body is just text.
The error message on this:
Error: Error building site: "/Users/me/hugo/content/posts/2011/01/many-thanks.md:4:1": failed to unmarshal YAML: yaml: line 3: did not find expected key
I have no idea where it’s storing a key to be expected. Using a regular theme:
bootstrap-bp-hugo-theme
(Using the “don’t mess with too many things at once” learning style)
It’s all local, no git repo yet. I’m still a newb so I haven’t set anything up on git yet. Will do so and check back in when accomplished. Thanks @zwbetz
I was suffering the same problem. The solution that I found (after much fruitless editing attempts) was to use
hugo new posts/your_filename_here.md
and carefully replace the text within the title: field (leaving the “” in place). I also found that any error in the tags: field produced the same error code even though the error was in a different line.