Difficulty using new_post in blogdown

378 views Asked by At

I just converted my existing site from Hugo to blogdown. All I did was switch a few places where I used {{ .Site.BaseURL }} and all worked well. However, new posts do not seem to work using blogdown::new_post(). I think it's because my theme does not contain any archetypes based on the message below. Has anyone else run into this trouble and what's the fix?

ERROR 2017/09/04 16:58:13 Error processing archetype file /Users/jason/code/hugo-site/themes/jsonbecker/archetypes/default.md: unable to cast <nil> of type <nil> to Time
Error: unable to cast <nil> of type <nil> to Time
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'content/post/2017-09-04-switching-to-blogdown.md': No such file or directory

I'm assuming the file issue is a red herring since the directory content/post absolutely exists in my relative path from the project working directory I'm in and that the first step is just failing to generate the file.

All of the source is available here: https://github.com/jsonbecker/jsonbecker-hugo.

1

There are 1 answers

2
Yihui Xie On BEST ANSWER

Your archetype template default.md was invalid.

---
title:
author:
date:
---

It seems you just want an empty archetype, you may just delete this default.md. Or actually assign empty values to your YAML fields, e.g.,

---
title: ''
author: ''
date: ''
---