When I build my hugo-apero website in GitHub, I get the following error:

  Liquid Exception: Invalid Date: '{}' is not a valid datetime. in /_layouts/default.html
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    Invalid Date: '{}' is not a valid datetime.

Despite this error, I still can get my website deployed but I would like to understand how to fix this error because it is really annoying. I don't understand why this error message suddenly appears, since I never had any /_layouts/default.html file in my repo.

I had a look to similar examples (https://talk.jekyllrb.com/t/jekyll-on-mac-could-not-read-file-and-invalid-date-error-using-bundle-exec-jekyll-serve/7664/6, https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/troubleshooting-jekyll-build-errors-for-github-pages-sites,...) but did not find any answer that matches my problem.

2

There are 2 best solutions below

0
layal On BEST ANSWER

The solution is to add the empty file .nojekyll to the root of the project. Thank you @Matt Bannert for your advice. See Deploying static site to GitHub pages needs .nojekyll file.

3
Matt Bannert On

@BenjaminW. is on the right track here. Both Hugo and jekyll are so-called static website generators. That is, they use go (in the case of Hugo) or ruby (in the case of jekyll) to generate HTML/CSS/JS (which browsers can work with) from easy-to-edit .yaml, .toml, etc. files.

You are using the R blogdown package as an additional wrapper on top of hugo/jekyll. Afaik, blogdown can handle both jekyll and hugo, but you need to make a choice (see also here: https://bookdown.org/yihui/blogdown/jekyll.html)

Took a brief look at your code and was under the impression that you were mixing both generators. FWIW, since you are starting here and it may not be too late, I can warmly recommend https://quarto.org/docs/get-started/ to R users working on their personal website / blog. The CLI is really nice, well documented and state-of-the-art.