R package blogdown과 Netlify를 이용한 블로그 개설/관리 과정을 여기에 기록해 둠
How to create a blog using blogdown and Netlify
Create a new repository: https://github.com/junglee0713/blog2020
Clone the repository, e.g.
cd /Users/leej39/Dropbox/GitHub
git clone git@github.com:junglee0713/blog2020.git
(optional) Create an R project, say
/Users/leej39/Dropbox/GitHub/blog2020/blog2020.Rproj.(do only once) Open RStudio and install necessary packages, following instruction in https://bookdown.org/yihui/blogdown/installation.html
install.packages("blogdown")
blogdown::install_hugo()
- Make sure that
/Users/leej39/Dropbox/GitHub/blog2020does not include files other thanLICENSE, the RStudio project file (*.Rproj),READMEorREADME.md. If you are okay with the default theme, run the following
blogdown::new_site()
# or blogdown::new_site(theme = "user/repo")
# to choose a different theme
Change the configuration file
/Users/leej39/Dropbox/GitHub/blog2020/config.tomlas appropriate.If you want to delete example or unnecessary posts that came with the default theme, you can do so by deleting the corresponding
.mdor.htmlfiles under/Users/leej39/Dropbox/GitHub/blog2020/content.Stage changes in
/Users/leej39/Dropbox/GitHub/blog2020, commit, and push.Go to https://www.netlify.com/ and link the GitHub repository https://github.com/junglee0713/blog2020 so that Netlify can sync with GitHub and deploy any changes in the repository real time.
To create a new post, click on Addins in RStudio and use New Post. Use Update Metadata to update the metadata associated with the post.
As noted in https://bookdown.org/yihui/blogdown/static-files.html, all files under the
static/directory are copied topublic/when Hugo renders a website. Therefore one needs to be cautious about files understatic/. Also to build.Rmddocuments with custom output formats, i.e.,.Rmddocuments not using theblogdown::html_page()format, a custom build scriptR/build.Rmust be provided with a single line of code in it:
blogdown::build_dir("static")