简体   繁体   中英

Change the default directory for blogdown posts

Posts for the Hugo theme I am using are in the /content/blog directory, whereas the default for new posts created with blogdown::new_post() is the /content/post directory.

From looking at the function definition, there is a global option to change the directory new posts are saved to (the help indicates this, too):

new_post(title, kind = "default", open = interactive(), 
    author = getOption("blogdown.author"), categories = NULL, 
    tags = NULL, date = Sys.Date(), file = NULL, slug = NULL, 
    subdir = getOption("blogdown.subdir", "post"), ext = getOption("blogdown.ext", 
        ".md"))

It looks like if I changed getOption("blogdown.subdir", "post") to getOption("blogdown.subdir", "blog") , then this might do the trick, but how can I do this so that it would be the default for all posts?

You need options(blogdown.subdir = 'blog') . Please read Section 1.4 of the blogdown book for more information.

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