Change the default directory for blogdown posts

ⅰ亾dé卋堺 提交于 2019-12-08 01:06:16

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/48063509/change-the-default-directory-for-blogdown-posts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!