Introduction to the

Do you really want to start your own personal blog? And why use BlogDown to build a blog? Is it difficult, and what are the advantages compared to other blogs?

After using the blog for a while, I think the advantage of BlogDown is the combination of Rmarkdown and Hugo, plus Github and a deployable site. You can easily upload Rmarkdown articles automatically. The advantage of Rmarkdown is that the results of your code can be rendered easily. Instead of “copy and paste” the result!

If you still can’t Rmarkdown, then please look at the end of the article for you to provide Rmarkdown learning gift package, combined with B station video learning effect is better, you can ask questions in the public number, xiaobian is willing to answer for you.

Blogdown: Creating Websites with R Markdown Www.blogDown.com Www.blogDown: Creating Websites with R Markdown

Introductory tutorial

The installation

First you need to install the BlogDown package

install.packages("blogdown")
Copy the code

Note: We are operating under Rstudio.

create

After installation, create a New Project (file-new Project) and select New Directory. Then scroll to the bottom, find Website using blogDown and click to enter.

At this point, enter the following interface. It is recommended that the project name be in English and the directory be selected by yourself. By default, the Hugo theme is xie yihui’s template, but I’ve expanded it by using another favorite theme: Fastbyte01/KeepIt. Check the box in the lower left corner to open a new session.

Note: In order to ensure the integrity of the entire demonstration process, the tutorial on selecting other topics is placed at the end of the article as additional content. Please pay attention to the logic of my demonstration, so as not to get confused. And this tutorial is also small make up in the previous period of trial and error to get.

The new interface looks like this, with the whole project files in the bottom right corner, the most important ones circled, which we’ll cover later. Let’s compile the initial BlogDown.

  • compile

Select tool-addins (easier to find on Windows) and then select the following button.

Wait a minute and you’ll get the original blog template!

If you do this, congratulations! We’re almost a third of the way there! Yes, it’s that simple.

The template to modify

Different templates change differently, but the principles are similar, and if you know some HTML, it’s probably better. If not, change slowly!

Use tip: Change a place, report an error, the lower right corner viewer automatically compiles, and you can see if the change is the result you want (” dumb “method).

Here is my template as an example: the main modification is the config.yaml file, first open it, the interface is as follows:

The main change is the title (4 lines), subtitle (84 lines), at this time save the file, the bottom right corner can quickly get the following interface:

If you want to change the avatar, you can find the code avatar: /images/me/avatar.jpeg in line 34 of the YAML file. At this point, open the folder from the desktop and change the JPEG file, for example:

At this point, if the interface is not updated (possibly a bug), you can run the code like a reboot:

blogdown::stop_server()
blogdown:::serve_site()
Copy the code

And now we’re done! Other create a new blog, internal format to modify what, a lot of content, we next in detail, remember to pay attention to my public number, dry goods on.

Connect your project to Github

Now that the local blog is basically built, the next step is to connect it to its own Github and deploy it to free sites.

First, upload the folder to your own Github. You can use Git, but it’s not very old, so use the desktop version of Github with buttons.

Note: If you’re using Github for the first time and haven’t yet downloaded the desktop version of Github. You can search through Baidu, simple study below. I won’t give you an introduction (I’m not very good at it, so I won’t teach you how to swim)

  • Github desktop version operation

Connect to your local folder (ZSS) and follow the image below.

Then, if the screen comes up, you can do what I did: click on the blue words

Go to the screen here, which will set the name of the online Github repository. With that done, you can create a new repository.

The created repository is then published. Make sure you uncheck the Keep this code private check (to become a public repository).

  • Check whether upload

At this point, you can go to your GitHub to check if this repository is available. Mine is as follows.

The local project is now connected to Github.

Congratulations, this time you have returned 2/3! You’ll soon have your own personal website!

Deploy your web site with Netify

Here I’m using Netify:app.netlify.com. You can also use other ways to deploy, as described in Creating Websites with R Markdown section 3.

The first is to register (here I have forgotten how to operate, because the creation of a long time, but it is not difficult, if you can not get into the possible you need to science online). Then connect it to Github and go to the following page:

Click Create a Site from Git and follow the steps. Click on Github in the lower left corner and select the repository (ZSS) we just created.

Then deploy the site according to the following interface.

At this point, the deployment will take some time, but with the following interface, you can use Site Settings to change your Site name (not demo here, very simple).

Wait for a moment to get the following interface, click the link of the website, you can get your own website!

Congratulations, it’s over! You already know how to easily create your own website!

Of course, you can reset the name of the site in the site Settings mentioned earlier. For example, my demo site is zss001.netlify.app/

Attachment: Hugo theme selection

The Hugo theme site offers a number of free trial theme templates. You can choose a theme you like (it doesn’t have to be the same as mine above). The cover of the site looks like this:

Xiaobian just used: A simple but not simpler blog theme for Hugo, enter the screen as follows, and then click View Github to enter the corresponding repository.

After opening his Github repository, copy the name to the interface (Hugo Theme) you created.

That’s how I got the theme I just mentioned!

Xiaobian has something to say

  • If you’re a beginner, you’re not familiar with Rstudio, Github, Hugo, HTML. Zhuang Xiaobian suggests that you implement the whole process as I said before. Then expand to create different Hugo templates.

Xiaobian is aspiring before, take a very novel as a template, the results behind the wrong, always can not find the problem. I can’t get through the whole process.

  • Recently, the main reasons for the slow creation of the series are that they have to adapt to the Hong Kong environment and the heavy scientific research task. My hobby is to re-study blogdown, 🤡 and to share this more “awesome” thing in the easiest way!
  • This article does not include the creation of the blog, internal layout changes, etc., too much content, will be covered separately in the next issue. If you think I this content useful, welcome a key three! 🤪