There's a question here that deals with the formatting of dates for R Markdown. I'm using the blogdown package, and the answers there lead me to believe I could use: '`r format(Sys.Date(), "%Y-%m-%d")`'
in the YAML front matter. Running format(Sys.Date(), "%Y-%m-%d")
in the console gives me the date exactly as it would be in a regular Hugo blog post (i.e. "2017-02-03"), but this doesn't work with serve_site()
(the post comes out as Jan 1 0001). Any ideas for how to get around this? Or is it necessary to use date: "2017-02-03"
?
edit with doc example:
---
title: "new post"
author: Robert McDonnell
date: '`r format(Sys.Date(), "%Y-%m-%d")`'
categories:
- R
- yaml
tags:
- R
draft: true
---
The error returned from build_site()
is:
ERROR: 2017/02/03 13:41:23 page.go:555: Failed to parse date '`r format(Sys.Date(), "%Y-%m-%d")`' in page post/x.html