Sergi Ballestar
First of all, we need to set some git parameters in our R Studio terminal:
git config --global user.name "sergiballestar"
git config --global user.email "xxxxxxx@gmail.com"
Then we need to clone the git repo were we will safely store our blogdown source code. otherwise we might lose our code and have to start from the very begining to edit anything.
git clone https://github.com/sergiballestar/blogdown_source.git
In case this was the last repo we worked with, a simple git init
may
be enough.
Here comes the funny part. Before creating the new site we need to check that all the packages are properly installed:
install.packages("blogdown")
library(blogdown)
blogdown::install_hugo()
Now that everything is settled up, let’s begin creating a new site. I
would encourage you the check HUGO’s
themes. In this case we’ll go with one of
the most popular theme, Academic by George
Cushen. Please mind that in this
case we chose theme_example = TRUE
but you can set it to FALSE
, if
prefered.
Let’s come back to R console (not the terminal):
blogdown::new_site(theme = "gcushen/hugo-academic", theme_example = TRUE)
If your theme is not pre-installed in HUGO yet, you can try installing it this way (please mind in this case “Creative portfolio” by Kishan B theme was chosen as example):
install_theme("kishaningithub/hugo-creative-portfolio-theme", theme_example = TRUE, update_config = TRUE)
Once the new_site()
was created check the diferent folders and add the
content you consider.
Use this commands to preview how your work will be seen (and to stop the preview)
serve_site() #preview
stop_server() #stop preview
Once your site is finished, just use this command to build it:
build_site()
you can change this options, check the information package for more info:
build_site(local = FALSE, method = c("html", "custom"), run_hugo = TRUE)
Let’s come back to the terminal:
Adding files:
git add -A
Check if new files were added:
git status
Write here the changes you made
git commit -m "blablabla"
Push it up (master branch as example)
git push origin master