简体   繁体   中英

Geekdocs HUGO template not compatible with blogdown

I'm trying to create my own version of the [Geekdown HUGO website][1]. I'm starting a new project through the RStudio add-in and I'm including thegeeklab/hugo-geekdoc as a theme. However, when it's all loaded, serving the site will instantly break with the following error message repeated:

ERROR 2021/01/13 14:13:02 render of "page" failed: execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "head" .>: error calling partial: "D:\Stefan\Gradient\Repositories\handbook\themes\hugo-geekdoc\layouts\partials\head.html:18:29": execute of template failed: template: partials/head.html:18:29: executing "partials/head.html" at <index .Site.Data.assets "main.min.css">: error calling index: index of untyped nil

To reproduce, this is all that's needed:

blogdown::new_site(theme = 'thegeeklab/hugo-geekdoc')

I haven't encountered an error like this before using blogdown, hugo and other themes. [1]: https://themes.gohugo.io/hugo-geekdoc/

There are two problems. One from the theme, and one from blogdown . The blogdown bug was just fixed . The problem with the theme is that the Github repo itself is not a complete Hugo theme, and there are extra files that need to be built. According to its documentation , you have to either download the full theme from its Github releases, or build it by yourself (using gulp ).

With the dev version of blogdown , which you can install via

remotes::install_github('rstudio/blogdown')

you can install this theme from its Github releases (remember to restart R after you install blogdown , before you try the code below):

blogdown::new_site(theme = 'https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz')

There is one minor problem with the theme in Github releases, though. That is, it doesn't contain the exampleSite folder. Unless you are familiar with the theme, or have read its documentation carefully, I'd suggest you copy the files and folders of its exampleSite folder into the root directory of your new website, before you run blogdown::serve_site() to preview the site. Without this step, the site works fine, but it will only contain a single sample post from blogdown .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM