Joshua Rosenberg
Joshua Rosenberg

Reputation: 4226

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?

Upvotes: 2

Views: 542

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30114

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

Upvotes: 3

Related Questions