Closed diegouriarte closed 2 years ago
The above checklist says:
- [x] included a minimal, self-contained, and reproducible example?
but I don't see your reproducible example...
The problem is that current, popular academic theme has the confg
file in another directory. There are two ways to solve this.
Either add wowchemy's usual config path to the config_files()
in utils.R, or copy the
config_files = function(which = generator()) {
all = list(
hugo = c('config.toml', 'config.yaml', file.path( "config", "_default", c('config.toml', 'config.yaml') )), # only support TOML and YAML (no JSON)
jekyll = '_config.yml',
hexo = '_config.yml'
)
if (is.null(which)) all else all[[which]]
}
or bring the "lost' config.yaml
or config.toml
out to the root directory. This an exception for the wowchemy templates, so I do not know which is the more elegant solution.
config_helper <- function( config_dir = file.path( "config", "_default") ) {
if ( ! dir.exists ( config_dir) ) {
warning( config_dir, " does not exist.")
return(NULL)
}
potential_config_files <- file.exists (file.path(config_dir, c('config.toml', 'config.yaml')))
if (! any(potential_config_files)) {
warning("No config.toml or config.yaml was found at config_dir='", config_dir, "'")
return(NULL)
}
actual_config_files <- file.path( config_dir, c('config.toml', 'config.yaml') )[potential_config_files]
message ( "Copying ", actual_config_files, " to the root directory of the project.")
file.copy (
from = actual_config_files,
to = c('config.toml', 'config.yaml')[potential_config_files],
overwrite = TRUE
)
}
For a non-programmatic solution, on a user level, just copy your config.yaml
or config.toml
to the root directory, too, but do not forget to keep it in synch with config/_default/config.*
, probably with regularly running file.copy()
with the above parameters.
@antaldaniel Thanks! This has already been done in blogdown::new_site()
and blogdown::install_theme()
long time ago: https://github.com/rstudio/blogdown/blob/20a8258b39f5cbda7911cc8c0cdb35a4bb31aa52/R/hugo.R#L455-L465
As mentioned in #611, I'll just support the config dir instead of assuming the config file is under the root directory in the near future. Thanks anyway!
FYI the config dir is supported now: https://github.com/rstudio/blogdown/issues/611#issuecomment-962044694 Thanks!
Hi, 02-28 I was able to serve my site using serve_site(). However, today I'm receiving the following error:
I've already updated to the latest dev version but it didn't fixed the issue.
I'm able to build the site using blogdown::hugo_build()
Checklist
When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:
[x ] formatted your issue so it is easier for us to read?
[x] used
blogdown::check_site()
function to diagnose your site and corrected potential problems?[x] included a minimal, self-contained, and reproducible example?
[x] pasted the output from
xfun::session_info('blogdown')
in your issue?[X] upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
[X] installed and tested your bug with the development version of the blogdown package using
remotes::install_github('rstudio/blogdown')
?