Changes in the location of the config.toml file break blogdown's new post addin


The latest version of the hugo academic theme changed the default location of the config.toml file from the root directory to config/_default/config.toml which breaks the blogdown:::new_post_addin(). You can see that with this version of the CDSB community website source files

Initially I wanted to test if the new post addin would work in this multi-lingual site. Anyhow, I'm posting the issue here in case anyone has a solution before posting it on the blogdown repo. Maybe this could be solved by making a soft link on the root directory to the config/_default/config.toml file instead of having to change the blogdown code.


> blogdown:::new_post_addin()
Error in blogdown:::site_root() : 
  Could not find config.toml / config.yaml under
> options(width = 120)
> sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                                      
 version  R version 3.5.2 Patched (2019-02-17 r76113)
 os       macOS Mojave 10.14.4                       
 system   x86_64, darwin15.6.0                       
 ui       RStudio                                    
 language (EN)                                       
 collate  en_US.UTF-8                                
 ctype    en_US.UTF-8                                
 tz       America/New_York                           
 date     2019-04-05                                 

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source                            
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.5.2)                    
 blogdown      0.11.1  2019-04-05 [1] Github (rstudio/blogdown@5179caf) 
 bookdown      0.9     2018-12-21 [1] CRAN (R 3.5.0)                    
 cli           1.1.0   2019-03-19 [1] CRAN (R 3.5.2)                    
 colorout    * 1.2-0   2019-02-18 [1] Github (jalvesaq/colorout@cc5fbfa)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.5.0)                    
 knitr         1.22    2019-03-08 [1] CRAN (R 3.5.2)                    
 packrat       0.5.0   2018-11-14 [1] CRAN (R 3.5.0)                    
 rstudioapi    0.10    2019-03-19 [1] CRAN (R 3.5.2)                    
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.5.0)                    
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.5.0)                    
 xfun          0.6     2019-04-02 [1] CRAN (R 3.5.2)                    

[1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library
$ hugo version
Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown
$ git --git-dir=themes/academic/.git log | head -1
commit 6778929449aed94edc1eaf642c0c44ac89fff819
1 Like

Or maybe it's just a matter of changing this line of the blogdown package from

config_files = c('config.toml', 'config.yaml')


config_files = c('config.toml', 'config.yaml', 'config/_default/config.toml', 'config/_default/config.yaml')
1 Like

@apreshill and I exchanged a couple of tweets at and in the end:

ln -s config/_default/config.toml config.toml

solves the issue.

If you use blogdown::install_theme() then you won't run into this problem since that function moves the config.toml file to the expected location by blogdown.

Ah perfect! For posterity, here is the commit so you can see what blogdown was doing under the hood:

And the issue where I described it more:

I imagine you could use fs to do the same within the R console (for completeness!):

file_move(path = "config/_default/config.toml", new_path = "config.toml")
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.