MYaseen208
MYaseen208

Reputation: 23898

Changing subdir in new_post in blogdown R package

I want to change subdir to content/myaseen208 for new_post R function from blogdown. However, my following code is producing ASD.md in content rather than in content/myaseen208. Any thoughts, please.

# Creating New Post
library(blogdown) 
options(
  blogdown.author = "Muhammad Yaseen"
  , blogdown.subdir = "myaseen208"
  , blogdown.ext    = ".md"
)

# options()$blogdown.subdir

blogdown::new_post(
    title      = "ASD"
  , kind       = "default"
  , open       = interactive()
  , author     = "Muhammad Yaseen"
  , categories = c("Statistics", "R")
  , tags       = NULL
  , date       = Sys.Date()
  , file       = "ASD.md"
  , slug       = NULL
  , title_case = getOption("blogdown.title_case")
  #  , subdir     = getOption("blogdown.subdir", "myaseen208")
  , ext        = getOption("blogdown.ext", ".md")
)

My sessionInfo() is

sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
[5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
[7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
[9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
  [1] blogdown_0.6

loaded via a namespace (and not attached):
  [1] compiler_3.4.4 tools_3.4.4    yaml_2.1.18    xfun_0.1   

Upvotes: 1

Views: 42

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30114

That is because you have provided the file argument to blogdown::new_post(). When it is provided, new_post() will respect your choice, and assume it is exactly the path you want. In your case, you either leave out file (let new_post() generate a path for you), or provide the full path, e.g., file = 'myaseen208/ASD.md'.

Upvotes: 1

Related Questions