What is a Blog?

Definition of blog

A blog (shortening of weblog) is an online journal or informational website displaying information in the reverse chronological order, with latest posts appearing first.

It is a platform where a writer or even a group of writers share their views on an individual subject.

The requisites of our blog

Out aim is to crate a simple blog by the following collection of tools:

This will allow us to:

R Markdown

R Markdown is a file format to make dynamic documents in R.

An R Markdown document is written in
markdown (an easy-to-write plain text format)
and contains chunks of embedded R code.

Example:

        # Plotting a simple Histogram 
        
        We generate a number `n=50` of 
        **Normal** disributed random variables 
        and plot them as an histogram
        
        ```{r}
         hist(rnorm(50))
        ```   

Plotting a simple Histogram

We generate a number n=50 of Normal disributed random variables and plot them as an histogram

blogdown + RStudio

blogdown is a package in R, developed by Yihui Xie (also author of knitr), that facilitates to build blogs with R Markdown in RStudio.

It is mainly tailored for the static generator Hugo, but following the author of the package, we tweak it to make it work with the static generator Jekyll.

Book published on 2017:

“blogdown: Creating Websites with R Markdown”
by Y. Xie, A. P. Hill, A. Thomas

it is also available on-line

git + GitHub

To manipulate locally repositories from your coputer, you need to download and istall git.

Associate RStudio with Github

Create a new RStudio project

Then

Configure for Jekyll on GitHub Pages

Configure for Jekyll on GitHub Pages

Add an index.html page

Make your FIRST post

The blog works!

Now going to the url of the GitHub Pages of our repository,

the blog WORKS!

To run it locally:

You need to have Jekyll installed

  • run bundle install
  • run bundle exec jekyll serve
  • open in the browser the url http://127.0.0.1:4000/

Jekyll

Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites.

Jekyll is the engine behind GitHub Pages, which you can use to host sites right from your GitHub repositories.

Make Jekyll the generator for blogdown

Make Jekyll the generator for blogdown

Make your SECOND post

A new file named 2019-03-05-hello-jekyll.Rmd
will be added in the _posts directory
and it will be opened for modifications.

Make your SECOND post

Make your SECOND post

you can download the file here 2019-03-05-hello-jekyll.Rmd

Make your SECOND post

Needing some formulas

What we finally miss is to include in our posts some
nice formulas

So let us prepare our blog and make our third post!

Jekyll directory structure

.
├── _config.yml
├── _data
|   └── members.yml
├── _drafts
|   ├── begin-with-the-crazy-ideas.md
|   └── on-simplicity-in-technology.md
├── _includes
|   ├── footer.html
|   └── header.html
├── _layouts
|   ├── default.html
|   └── post.html
├── _posts
|   ├── 2007-10-29-post-2.md
|   └── 2009-04-26-post-1.md
├── _sass
|   ├── _base.scss
|   └── _layout.scss
├── _site # generated by jekyll and containing the website
├── .jekyll-metadata
├── Gemfile
├── Gemfile.lock
└── index.html # can also be an 'index.md' with valid front matter

The theme minima directory structure

The theme minima directory structure

/usr/local/lib/ruby/gems/2.5.0/gems/minima-2.5.0
├── _includes
|   ├── disqus_comments.html
|   ├── footer.html
|   ├── google-analytics.html
|   ├── head.html
|   ├── header.html
|   ├── icon-github.html
|   ├── icon-github.svg
|   ├── icon-twitter.html
|   ├── icon-twitter.svg
|   └── social.html
├── _layouts
|   ├── default.html 
|   ├── home.html
|   ├── page.html
|   └── post.html
├── _sass
|   ├── minima
|   |   └── ...
|   └── minima.scss
├── assets
|   ├── main.scss
|   └── minima-social-icons.svg
├── LICENSE.txt
└── README.md

Customize the blog to allow formulas

Customize the blog to allow formulas

Make your THIRD post

A new file named 2019-03-15-hello-math.Rmd
will be added in the _posts directory
and it will be opened for modifications.

Make your THIRD post

Make your THIRD post

you can download the file here 2019-03-15-hello-math.Rmd

Working with Themes

Jekyll is very powerful for

However this has a cost:

therefore there is some extra work to do!

We are going to work with: Minimal Mistakes theme

Minimal Mistakes theme

Minimal Mistakes theme

Minimal Mistakes theme

More resources

Jekyll

online books

Thanks

Coding Club UC3M

tidyverse ecosystem

Slides created via R Mardown package and ioslides

Blog created with Jekyll

Hosted in GitHub

Using RStudio and blogdown package

plus some tweaks of the Yihui Xie`s blogdown-jekyll repository