2
votes

I am trying to create a website using blogdown through RStudio. I create a new project, create a new directory and enter in matcornic/hugo-theme-learn for the theme value. The Learn theme can be found at https://github.com/matcornic/hugo-theme-learn . I am following the basic steps outlined in the blogdown book. My new directory is a sub-directory on my desktop.

When I attempt to build the website using RStudio through Addins - Serve Site I receive an error message indicating the hugo-theme-learn folder cannot be located because it is attempting to locate the hugo-theme-learn folder on my Desktop, and not in my Project directory. If I copy and paste the hugo-theme-learn folder to my Desktop, it seems to run fine. I have tried changing the themesdir value but it is still searching my Desktop for the hugo-theme-learn folder. Any ideas are greatly appreciated!

My R sessionInfo() below:

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

and my hugo verision:

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

For reference, the error message I receive is:

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 

and the default config.toml file is:

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
1
To make sure I understand the steps you did, is the following correct? You made a new .Rproj for your local version of the website materials. While in that project, you used blogdown::new_site(theme = "matcornic/hugo-theme-learn") to create a site with your chosen theme. The theme was then downloaded into a folder called "themes" in your directory.aosmith
Also, I saw in this comment that the hugo-icarus theme says something about commenting out themesdir for "use in production". Have you tried that? I don't have the themesdir option in config.toml for any of the three themes I use.aosmith
@aosmith I apparently did not try ONLY commenting out themesdir although I spent a lot of time trying various configurations such as commenting that AND changing baseURL for example...that appears to have done it! Please put your comment as an answer and I will accept it. Thank you!Prevost

1 Answers

2
votes

You can comment out the themesdir line all together to bypass the problem.

Note that other themes, like hugo-icarus-theme, have a comment included in the theme config.toml to mention this as a possibility. That theme says to comment the themesDir option if you use this theme in production.