在 blogdown 中找不到 hugo 主题目录

hugo theme directory not found in blogdown

我正在尝试通过 RStudio 使用 blogdown 创建一个网站。我创建一个新项目,创建一个新目录并输入 matcornic/hugo-theme-learn 作为主题值。学习主题可以在 https://github.com/matcornic/hugo-theme-learn 找到。我正在按照 blogdown 书中概述的基本步骤进行操作。我的新目录是我桌面上的一个子目录。

当我尝试通过 Addins - Serve Site 使用 RStudio 构建网站时,我收到一条错误消息,指示找不到 hugo-theme-learn 文件夹,因为它正在尝试在我的桌面上找到 hugo-theme-learn 文件夹,而不是在我的项目目录中。如果我将 hugo-theme-learn 文件夹复制并粘贴到我的桌面,它似乎 运行 没问题。我已尝试更改 themesdir 值,但它仍在我的桌面上搜索 hugo-theme-learn 文件夹。非常感谢任何想法!

下面我的RsessionInfo()

R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] blogdown_0.1         RevoUtils_10.0.6     RevoUtilsMath_10.0.1

loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2    yaml_2.1.14

和我的 hugo 版本:

Hugo Static Site Generator v0.41 windows/amd64 BuildDate: 2018-05-25T16:57:53Z

作为参考,我收到的错误信息是:

Error: Unable to find theme Directory: C:\Users\scott.prevost\hugo-theme-learn

The system cannot find the path specified.
Error in shell(cmd, mustWork = TRUE, intern = intern) : 
  '"C:\Users\scott.prevost\AppData\Roaming\Hugo\hugo.exe" -b /localhost:1313/test -D -F -d "public" -t hugo-theme-learn' execution failed with error code 1
In addition: Warning messages:
1: running command '"C:\Users\scott.prevost\AppData\Roaming\Hugo\hugo.exe" -b /localhost:1313/test -D -F -d "public" -t hugo-theme-learn' had status 65535 
2: running command '"C:\Users\scott.prevost\AppData\Roaming\Hugo\hugo.exe" -b /localhost:1313/test -D -F -d "public" -t hugo-theme-learn' had status 65535 
3: running command 'C:\WINDOWS\system32\cmd.exe /c "C:\Users\scott.prevost\AppData\Roaming\Hugo\hugo.exe" -b /localhost:1313/test -D -F -d "public" -t hugo-theme-learn' had status 1 

默认的 config.toml 文件是:

baseURL = "localhost:1313/test"
languageCode = "en-US"
defaultContentLanguage = "en"

title = "Hugo Learn Documentation"
theme = "hugo-theme-learn"
themesdir = "../.."                    # I have tried changing this
metaDataFormat = "yaml"                # I have tried changing this to "toml"
defaultContentLanguageInSubdir= true

[params]
  editURL = "https://github.com/matcornic/hugo-theme-learn/edit/master/exampleSite/content/"
  description = "Documentation for Hugo Learn Theme"
  author = "Mathieu Cornic"
  showVisitedLinks = true

[outputs]
home = [ "HTML", "RSS", "JSON"]

[Languages]
[Languages.en]
title = "Documentation for Hugo Learn Theme"
weight = 1
languageName = "English"

[[Languages.en.menu.shortcuts]] 
name = "<i class='fa fa-fw fa-github'></i> Github repo"
identifier = "ds"
url = "https://github.com/matcornic/hugo-theme-learn"
weight = 10

[[Languages.en.menu.shortcuts]]
name = "<i class='fa fa-fw fa-camera'></i> Showcases"
url = "showcase"
weight = 11

[[Languages.en.menu.shortcuts]]
name = "<i class='fa fa-fw fa-bookmark'></i> Hugo Documentation"
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20

[[Languages.en.menu.shortcuts]]
name = "<i class='fa fa-fw fa-bullhorn'></i> Credits"
url = "/credits"
weight = 30

[Languages.fr]
title = "Documentation du thème Hugo Learn"
weight = 2
languageName = "Français"

[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-fw fa-github'></i> Repo Github"
identifier = "ds"
url = "https://github.com/matcornic/hugo-theme-learn"
weight = 10

[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-fw fa-camera'></i> Vitrine"
url = "/showcase"
weight = 11

[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-fw fa-bookmark'></i> Documentation Hugo"
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20

[[Languages.fr.menu.shortcuts]]
name = "<i class='fa fa-fw fa-bullhorn'></i> Crédits"
url = "/credits"
weight = 30

您可以将 themesdir 行全部注释掉以绕过该问题。

请注意,其他主题,如 hugo-icarus-theme,在主题 config.toml to mention this as a possibility 中包含评论。如果您在生产中使用此主题,该主题会评论 themesDir 选项