---
title: "Making Websites with R Markdown"
subtitle: "Meet blogdown"
author: "Alison Hill"
date: "2019/01/15 (updated: `r Sys.Date()`)"
output:
  xaringan::moon_reader:
    css: ["default", "css/ada.css", "css/fonts.css"]
    lib_dir: libs
    nature:
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
      ratio: "16:9"
      beforeInit: "https://platform.twitter.com/widgets.js"
    seal: false 
    includes:
      in_header: header.html
---

```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
library(knitr)
knitr::opts_chunk$set(warning = FALSE, message = FALSE, fig.align = "center", out.width = "80%")
# options(knitr.table.format = "html")
library(tidyverse)
library(fontawesome) # from github: https://github.com/rstudio/fontawesome
library(fs)
library(magick)
```

layout: true
  
<div class="my-footer"><span>arm.rbind.io/slides/blogdown</span></div>

<!-- this adds the link footer to all slides, depends on my-footer class in css-->

---
name: blogdown-title
background-image: url(img/ada_lovelace_cropped.png)
background-size: cover
class: inverse

# Meet blogdown

<img src="https://bookdown.org/yihui/blogdown/images/logo.png" alt="Blogdown" width="180" />

### .fancy[Making Websites in R Markdown]

.large[Alison Hill | rstudio::conf | `r Sys.Date()`]

<!-- this ends up being the title slide since seal = FALSE-->

---

## So what is blogdown?<sup>*</sup>


- [R Markdown](https://rmarkdown.rstudio.com) <img src="https://www.rstudio.com/wp-content/uploads/2015/12/RStudio_Hex_rmarkdown.png" width="10%" align="right" />

    - (relatively) simple syntax for writing documents
    
    - the simpler, the more portable (multiple output formats)
    
    - not only convenient (maintenance), but also reproducible
    
    - most features of R Markdown _and_ [**bookdown**](https://bookdown.org) (technical writing)!!

--

- [Hugo](https://gohugo.io) <img src="https://gohugo.io/img/hugo.png" width="10%" align="right" />

    - free, open-source, and easy to install (a single binary)
    
    - lightning fast (generates one page in one millisecond)
    
    - general-purpose (not only for blogs)

.footnote[
[\*] From Yihui: https://slides.yihui.name/2017-rmarkdown-UNL-Yihui-Xie.html#35.
]

???

Pandoc's Markdown: paragraphs, section headings, (un)numbered lists, blockquotes, math expressions, tables, images, footnotes, bibliography/citations, ...

See Chapter 2 of the **bookdown** book for additional Markdown features, such as figure/table captions, cross-references, numbered equations, theorems, ...


---

## Why not WordPress, Tumblr, Medium.com, Blogger.com, etc?<sup>*</sup>

- No R Markdown support (even math support is often nonexistent or awkward)

--

- Huge benefits of static websites compared to dynamic websites

    - all static files, no PHP or databases, no login/password, work everywhere (even offline)
    
    - typically fast to visit (no computation needed on the server side), and easy to speed up via CDN

.footnote[
[\*] From Yihui: https://slides.yihui.name/2017-rmarkdown-UNL-Yihui-Xie.html#36.
]

???

If all you want to write about is what you had for breakfast today, or how cute your kittens are, there is no need to use blogdown. If there is anything related to R, statistical computing, and/or graphics, blogdown will be much more convenient.


---
class: inverse, middle, center

# .fancy[Build a site for [Ada Lovelace](https://en.wikipedia.org/wiki/Ada_Lovelace)]

![](https://lh3.googleusercontent.com/iXmJ9aWblkGDpg-_jpcqaY10KmA8HthjZ7F15U7mJ9PQK6vZEStMlathz1FfQQWV5XeeF-A1tZ0UpDjx3q6vEm2BWZn5k1btVSuBk9ad=s660)

--

.pull-left[
### .fancy[.center[Local with GitHub]]
### .fancy[.center[`r emo::ji("computer")` + <i class="fab fa-github fa-lg fa-fw"></i>]]
]

--

.pull-right[
### .fancy[.center[Cloud or Local (no GitHub)]]
### .fancy[.center[`r emo::ji("cloud")` | `r emo::ji("computer")`]]
]




---
name: start-here
class: inverse, middle

.pull-left[
### .fancy[.center[Local with GitHub]]
### .fancy[.center[`r emo::ji("computer")` + <i class="fab fa-github fa-lg fa-fw"></i>]]



1. Make a [repo on <i class="fab fa-github fa-lg fa-fw"></i>GitHub](https://happygitwithr.com/new-github-first.html#make-a-repo-on-github-1)

1. Make a [new RStudio project via git clone](https://happygitwithr.com/new-github-first.html#new-rstudio-project-via-git-clone) <br>
    *File > New Project > Version Control > Git*

1. Run:

```{r eval = FALSE}
library(blogdown)
new_site(theme = "jpescador/hugo-future-imperfect", 
         sample = TRUE, 
         theme_example = TRUE, 
         empty_dirs = TRUE,
         to_yaml = TRUE)
```

]

.pull-right[
### .fancy[.center[Cloud or Local]]
### .fancy[.center[`r emo::ji("cloud")` | `r emo::ji("computer")`]]


1. Make a new RStudio project via wizard <br> 
    *File > New Project > New Directory*

1. Scroll down to select: <br>
    <img src="https://discourse-cdn-sjc2.com/standard10/uploads/gohugo/original/2X/c/c2d3414c64e766d814100b32063948e604298a70.png" width="4%"> *Website using blogdown*

```{r echo = FALSE, out.width='80%'}
knitr::include_graphics("img/blogdown-workflow-wizard.png")
```


]


???

if an exampleSite exists, it will be in themes/<hugo-future-imperfect>/exampleSite


theme_example copies that exampleSite into your project root directory (you can always delete the content later)


sample adds a sample R Markdown blog post (can end up in wrong place though)

empty_dirs keeps some folders that are initially empty but for important reasons I'll tell you about

finally, to_yaml converts all the exampleSite content to YAML instead of TOML files. We'll talk more about the difference, but this saves you time and is helpful to have done automatically for you.


---
name: block1
class: middle, inverse, center

# `r emo::ji("crystal_ball")`

## Gaze into your directory structure

.footnote[
https://bookdown.org/yihui/blogdown/a-quick-example.html
]


---
name: dir-structure

# `r emo::ji("closed_lock_with_key")` Directory Structure

```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/ 
├── config.toml
├── content/
├── data/
├── index.Rmd
├── layouts/ 
├── public/
├── resources/
├── static/
├── staticman.yml
└── themes/
```


.footnote[
https://gohugo.io/getting-started/directory-structure/
]

---
name: hugo-index

# `r emo::ji("closed_lock_with_key")` Directory Structure

```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/ 
├── config.toml
├── content/
├── data/
├── index.Rmd # DO NOT TOUCH #<<
├── layouts/ 
├── public/ 
├── resources/
├── static/
├── staticman.yml
└── themes/
```

--

```{yaml}
---
site: blogdown:::blogdown_site
---
```

???

index.Rmd does one thing- let's open it up- it is your only R markdown YAML. It specifies your output format as a blogdown site. This is specific to using Hugo via blogdown.


---
name: hugo-public

# `r emo::ji("closed_lock_with_key")` Directory Structure

```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/ 
├── config.toml
├── content/
├── data/
├── index.Rmd 
├── layouts/ 
├── public/ # IGNORE #<<
├── resources/
├── static/
├── staticman.yml
└── themes/
```

???


public is where your final rendered site files will go

You can mostly ignore this folder- it re-generates every time we serve our site


---
name: noknit
class: middle, inverse, center

# DON'T `r emo::ji("knit")` KNIT!

![](https://media.giphy.com/media/Vg6vGMxVs9Sve/giphy.gif)

---
name: serve

class: center, inverse, middle

# `r emo::ji("bellhop_bell")`

# .fancy[Serve site!]

Mouse up to "Addins" `r emo::ji("arrow_right")` "Serve site"

![](img/addin-serve-site.png)


---
class: center, inverse, top

# `r emo::ji("peacock")` Success?


```{r echo = FALSE, out.width='75%'}
include_graphics("img/blogdown-exampleSite.png")
```


.footnote[
.fancy[.bright["Show in new window"]] to see in local browser
]

???

What are we seeing here? Everything that is the public folder. 

---
class: middle, inverse, center


```{r echo = FALSE, out.width="2000px"}
list_png <- c(here::here("static/slides/img/blogdown-lifecycle-01.png"),
              here::here("static/slides/img/blogdown-lifecycle-02.png"),
              here::here("static/slides/img/blogdown-lifecycle-03.png"))

list_png %>% 
  map(image_read) %>% # reads each path file
  image_join() %>% # joins image
  image_scale("2000") %>% 
  image_animate(fps = .5)  # animates, can opt for number of loops
```

---
name: earlydeploy
class: middle, inverse, center

# `r emo::ji("mega")`

---
template: earlydeploy

## Go to [Netlify.com](https://www.netlify.com/) & Log in

```{r echo = FALSE}
knitr::include_graphics("img/netlify-landing.png")
```

---
template: earlydeploy


## Drag & drop the `public/` folder to [deploy](https://bookdown.org/yihui/blogdown/netlify.html)

```{r echo = FALSE, out.width='60%'}
knitr::include_graphics("img/netlify-new-site.png")
```


---
class: middle, inverse, center


```{r echo = FALSE, out.width="2000px"}
list_png <- c(here::here("static/slides/img/blogdown-lifecycle-04.png"),
              here::here("static/slides/img/blogdown-lifecycle-05.png"),
              here::here("static/slides/img/blogdown-lifecycle-06.png"))

list_png %>% 
  map(image_read) %>% # reads each path file
  image_join() %>% # joins image
  image_scale("2000") %>% 
  image_animate(fps = .5)  # animates, can opt for number of loops
```


---
name: yourturn
class: middle, inverse

.left-column[
<br>
<br>
<br>
<br>
```{r echo = FALSE, out.width='75%'}
knitr::include_graphics("img/Ada_Lovelace_color.svg")
```

<!--![](img/Ada_Lovelace_color.svg)-->
]

.right-column[
# <i class="fas fa-edit"></i> .fancy[Your turn]
]

---
name: yourturn-1
template: yourturn

.right-column[
# .fancy[05:00 minutes]
### Gaze into your directory structure, and site.

Ideas:

+ Where are the `.md` files for the .bright[blog posts]? .fancy[(i.e., "Creating A New Theme")]
+ Where is the `.jpg` file you see in the .bright[hex image] stored? What about the featured images for each blog post?
+ Where is the `.md` file you see under .bright[About]? .fancy[(i.e., "Hugo is a static site engine written in Go.")]
+ Where are the `.md` files you see under .bright[Itemized]? .fancy[(i.e., fancy apps 1-4)]

]

---
name: outline
class: middle, inverse


# .fancy[Outline]

1. ~~Gaze into your directory structure~~ [`r emo::ji("key")`](#block1) [`r emo::ji("trophy")`](#yourturn-1)

1. Edit the `config.toml` [`r emo::ji("key")`](#block2) [`r emo::ji("trophy")`](#yourturn-2)

1. Edit the `exampleSite` content [`r emo::ji("key")`](#block3) [`r emo::ji("trophy")`](#yourturn-3)

1. Add new content [`r emo::ji("key")`](#block4) [`r emo::ji("trophy")`](#yourturn-4)

1. Deploy [`r emo::ji("key")`](#block5)  [`r emo::ji("trophy")`](#yourturn-5)



---
name: block2
class: middle, inverse, center

# `r emo::ji("house_with_garden")`

## Edit the configuration file

.footnote[
https://bookdown.org/yihui/blogdown/configuration.html
]

---

# Edit `config.toml`

```{r eval = FALSE}
baseurl = "/" #<<
languageCode = "en-us"
title = "Ada Lovelace" #<<
theme = "hugo-future-imperfect"
preserveTaxonomyNames = true
paginate = 3
disqusShortname = "shortname"
googleAnalytics = ""
pluralizeListTitles = false
# Set the followings to true as part of your site SEO
enableRobotsTXT = true
canonifyURLs = true
ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"] #<<
relativeURLS = true #<<
```

- `<title>Ada Lovelace</title>`

- `ignoreFiles`: copy and paste this from your R console when you first served your site

- *.bright[Very important!]* Setting `relativeURLS` is critical for `r emo::ji("cloud")` setup

???

The first thing I do with any new Hugo theme is make sure the baseurl is just a forward slash. That will always work. This theme has that already, but some don't

Do not change theme here- but it refers to the theme folder you want.

You could have multiple Hugo themes in your themes/ directory.

So the theme name should match the name of the folder that holds the theme you want to use.



---
class: middle, inverse, center

## `r emo::ji("new")` A full `public` folder



```{r out.width='35%', echo = FALSE}
knitr::include_graphics("img/blogdown-public.png")
```

---

# Back to `config.toml`



```{r eval = FALSE}
baseurl = "/" 
languageCode = "en-us"
title = "Ada Lovelace" 
theme = "hugo-future-imperfect"
preserveTaxonomyNames = true
paginate = 3
disqusShortname = "shortname"
googleAnalytics = ""
pluralizeListTitles = false
# Set the followings to true as part of your site SEO
enableRobotsTXT = true
canonifyURLs = true
ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
relativeURLS = true 
enableEmoji = true #<<

[params]
  # Sets the meta tag description
  description          = "Ada's blog" #<<
  # Sets the navbarTitle that appears in the top left of the navigation bar
  navbarTitle          = "Ada Lovelace" #<<
  # Sets where "View More Posts" links
  viewMorePostLink     = "/blog/"
```

???

There are some standard parameters in hugo config.toml files- just because it isn't in the site's example config doesn't mean you can use them!

---
name: livereload

class: center, inverse, middle

# `r emo::ji("bellhop_bell")`

# .fancy[Click save!]

Through the magic of .fancy[.bright[LiveReload]], 
you don't need to serve your site again.


???

What are we seeing here? Everything that is the public folder. 

---

# Add image

Mouse over to `static/img/main/` and see `logo.jpg`? We can replace that file, or make new file. I'll replace mine with [this picture](https://raw.githubusercontent.com/apreshill/ada-blog/hugo-theme-future-imperfect/static/img/main/ada_square.jpg).

```{r eval = FALSE}
[params.intro]
  header    = "Ada Lovelace" #<<
  paragraph = "A fine place to share my thoughts" #<<
  about     = "" #<<

  # This appears at the top of the sidebar above params.intro.header.
  # A width of less than 100px is recommended from a design perspective.
  [params.intro.pic]
    src       = "/img/main/ada_square.jpg" #<<
    # Sets Image to be a cirlce
    circle    = false
    # Sets Image to be Future Imperfect's hexagon
    imperfect = true
    width     = ""
    alt       = "Ada portrait from Wikipedia" #<<
```


???

In the Hugo framework, static things are images, CSS, JavaScript, etc.

So you can assume that any image files are expected to be somewhere in the static directory.

Here, it looks like the exampleSite used the path static/img/main. So mouse over there and see if you see logo.jpg. 

You could save over that image, or you can add another image and update the file name in the config file.


When Hugo builds your site, all assets inside your static directory are copied over as-is. 

---
class: center, inverse, top

# `r emo::ji("peacock")` Success?


```{r echo = FALSE, out.width='70%'}
include_graphics("img/blogdown-configs.png")
```


.footnote[
.fancy[.bright["Show in new window"]] to see in local browser
]

---
name: yourturn-2
template: yourturn

.right-column[
# .fancy[05:00 minutes]
### Edit the `config.toml` to customize your site.

Ideas:

+ Update your `[[menu.main]]` text, Font Awesome icons (or remove!), or switch weights (the order).
+ Set up your `[social]` media icons.
+ Change the `highlightjs` theme.
+ Switch some of the "Optional Params"- see what they do.

.bright[.fancy[Stretch:]] All possible Hugo configuration variables are [listed here](https://gohugo.io/getting-started/configuration/)- try some (like `enableEmoji = TRUE`)!

]

---
name: block3
class: middle, inverse, center

# `r emo::ji("tophat")`

## Edit the `exampleSite` content

.footnote[
https://bookdown.org/yihui/blogdown/content.html
]

---
name: hugo-themes

# `r emo::ji("closed_lock_with_key")` Directory Structure

```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/ 
├── config.toml
├── content/
├── data/
├── index.Rmd
├── layouts/ 
├── public/
├── resources/
├── static/
├── staticman.yml
└── themes/ # DO NOT TOUCH #<< 
```

???

themes is where all the Hugo theme files go.

This determines the look and layout of your site, as well as the bells and whistles that each individual Hugo theme developer employs. It also may leave out some Hugo bells and whistles that you DO want. 

IT ALL DEPENDS ON YOUR THEME

You also never touch this folder!

So how do you edit a Hugo theme if you are not to touch anything in this folder?

---
class: middle, inverse

# `r emo::ji("key")` Overriding vs editing

> *When you use a theme cloned from its git repository, do not edit the theme’s files directly. Instead, theme customization in Hugo is a matter of overriding the templates made available to you in a theme. This provides the added flexibility of tweaking a theme to meet your needs while staying current with a theme’s upstream.* 

.footnote[https://gohugo.io/themes/customizing/]




---
class: middle, inverse

# `r emo::ji("hole")` `empty_dirs = TRUE`

```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/ #<<
├── config.toml
├── content/
├── data/
├── index.Rmd
├── layouts/ #<<
├── public/
├── resources/
├── static/
├── staticman.yml
└── themes/
```

???

This is why we kept the empty directories when we started our site.

I believe having these here will help you when you do want to edit your theme, as a gentle reminder that you are never to touch the themes folder!

---

# Themes

Look in `/themes/hugo-future-imperfect/`. Notice now the folder structure here *mirrors* your Hugo directory structure.

```{r echo = FALSE, out.width='75%'}
include_graphics("img/blogdown-theme-dir.png")
```

---

# Override files in...

.pull-left[
your .fancy[.bright[theme]] directory...
```{r eval = FALSE}
└── themes/
|   └──  archetypes/ #<<
|   └──  exampleSite/
|   └──  images/
|   └──  layouts/ #<<
|   └──  static/ #<<
```
]

.pull-right[
...with files in your .fancy[.bright[project]] directory.
```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/ #<<
├── config.toml
├── content/
├── data/
├── index.Rmd
├── layouts/ #<<
├── public/
├── resources/
├── static/ #<<
├── staticman.yml
└── themes/
```
]

---
name: hugo-archetypes

# Hugo Archetypes

```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/ 
|   └──  blog.md #<<
|   └──  default.md #<<
|   └──  itemized.md #<<
├── config.toml
├── content/
├── data/
├── index.Rmd
├── layouts/
├── public/
├── resources/
├── static/ 
├── staticman.yml
└── themes/
```


???

You can create new content files in Hugo using the hugo new command. By default, Hugo will create new content files with at least date, title (inferred from the file name), and draft = true. This saves time and promotes consistency for sites using multiple content types. 

---
name: hugo-blog

# The blog archetype

.pull-left[
`themes/hugo-future-imperfect/archetypes/blog.md`
```js
+++
author = ""
categories = [""]
date = ""
description = ""
featured = ""
featuredalt = ""
featuredpath = ""
linktitle = ""
title = ""
type = "post" 
+++
```

]

.pull-right[
`content/blog/goisforlovers.md`
```js
---
author: Unknown Author
categories:
- Go
date: "2014-04-02"
description: ""
featured: pic02.jpg
featuredalt: Pic 2
featuredpath: date
linktitle: ""
title: (Hu)go Template Primer
type: post
---
```
]


---

# TOML vs. YAML

- TOML is like YAML, but not 
- blocks wrapped by `+++` vs `---` 
- Your `config.toml` file doesn't show this explicitly but it is there!
- key-value pairs are separated by a `=` vs `:` 
- YAML uses indentation with one or more spaces to describe nested collections 


--

This is why we used `new_site(to_yaml = TRUE)`!

--

If you end up with TOML in your content, try (after backing up your files):
```{r eval = FALSE}
hugo_convert(to = "YAML", unsafe = TRUE)
```



--

.footnote[
https://gohugohq.com/howto/toml-json-yaml-comparison/

https://learnxinyminutes.com/docs/yaml/

https://learnxinyminutes.com/docs/toml/
]

---
class: inverse, middle, center

# Archetypes `r emo::ji("arrows_counterclockwise")` Layouts
---
name: hugo-layouts

# Hugo Layouts

```{r eval = FALSE}
.
├── .Rproj.user/
├── ada-blog.Rproj
├── archetypes/
|   └──  blog.md #<<
|   └──  default.md #<<
|   └──  itemized.md #<<
├── config.toml
├── content/
├── data/
├── index.Rmd
├── layouts/ #<<
├── public/
├── resources/
├── static/ 
├── staticman.yml
└── themes/
```


???

Stores templates in the form of .html files that specify how views of your content will be rendered into a static website. 


---
name: yourturn-3
template: yourturn

.right-column[
# .fancy[05:00 minutes]
### Edit some `exampleSite` content, save, and let "LiveReload" preview your changes.

1. Edit the .bright[About] page.

1. Edit a .bright[Blog] post.

1. .bright[Challenge!] In `content/blog/` there is the sample `.Rmd` blog post titled .fancy["Hello R Markdown"]. Can you find it on the site? Can you spot the problem? .fancy[.bright[hint: it was to do with a YAML parameter that tells Hugo which layout to use]]

]

---
name: block4
class: middle, inverse, center

# `r emo::ji("postal_horn")`

## Add new content

.footnote[
https://bookdown.org/yihui/blogdown/rstudio-ide.html
]

---
class: middle, center

```{r echo = FALSE, out.width='70%'}
knitr::include_graphics("img/blogdown-newpost-unbundle.png")
```

---

# `r emo::ji("new")` Hugo Page Bundles

```{r eval = FALSE}
library(usethis)
edit_r_profile()
options(blogdown.new_bundle = TRUE) #<<
```


---

# `r emo::ji("seedling")` Page Bundles

```{r eval = FALSE}
content/
├── about #<<
│   ├── index.md
├── posts
│   ├── my-post #<<
│   │   ├── content1.md
│   │   ├── content2.md
│   │   ├── image1.jpg
│   │   ├── image2.png
│   │   └── index.md
│   └── my-other-post #<<
│       └── index.md
```

--

Allowed bundle resources:
+ Page and non-page (like images, pdf, etc.) types

--

.footnote[
https://gohugo.io/content-management/page-bundles/
]

---
class: middle, inverse, center

```{r echo = FALSE, out.width='70%'}
knitr::include_graphics("img/blogdown-newpost-bundle.png")
```

---
class: middle, inverse, center

```{r echo = FALSE, out.width='70%'}
knitr::include_graphics("img/blogdown-newcontent-other-bundled.png")
```

---
name: global-options

# `r emo::ji("earth_africa")` Other global options

```{r eval = FALSE}
library(usethis)
edit_r_profile()
options(blogdown.author = "Ada Lovelace",
        blogdown.ext = ".Rmd",
        blogdown.subdir = "blog",
        blogdown.yaml.empty = TRUE,
        blogdown.new_bundle = TRUE,
        blogdown.title_case = TRUE)
```

.footnote[
[Global options](https://bookdown.org/yihui/blogdown/global-options.html)

[More global options](https://bookdown.org/yihui/blogdown/more-global-options.html)
]

---
name: yourturn-4
template: yourturn

.right-column[
# .fancy[05:00 minutes]
### Add new content

1. .fancy[Optional:] Use `usethis::edit_r_profile` to add some **blogdown** global options.
  + Don't forget the blank line at the end, and restart your R session, serve your site again.

1. Use the "New Post" addin to create new content.<br>
  + Try adding a new post to .bright[Blog] (include a featured image in your bundle!)
  + Try adding a new project to .bright[Itemized]

]

   
---
name:workflow

# Workflow<sup>*</sup>


- Open your website project, click the "Serve Site" addin
    
- Revise old pages/posts, or click the "New Post" addin
    
- Write and save (take a look at the automatic preview)
    
- Push everything to Github

.footnote[
[\*] From Yihui: https://slides.yihui.name/2017-rmarkdown-UNL-Yihui-Xie.html#30.
]

---

# Theme examples

- [Mitchell O'Hara-Wild](https://blog.mitchelloharawild.com/)

- [Isabella Velásquez](https://ivelasq.rbind.io/)

- [Cool But Useless](https://coolbutuseless.github.io/)

---

# Blogdown resources

- [Blogdown demo site](https://blogdown-demo.rbind.io)
- [Blogdown book](https://bookdown.org/yihui/blogdown/)
- [I did a blog post on it](https://alison.rbind.io/post/up-and-running-with-blogdown/)
- [Also did a workshop](https://alison.rbind.io/talk/blogdown-meetup/)
- [Yihui's slides from RStudio Conf](https://slides.yihui.name/2018-blogdown-rstudio-conf-Yihui-Xie.html)

---
template: earlydeploy

# Update on Netlify

```{r echo = FALSE}
knitr::include_graphics("img/netlify-manual-update.png")
```

---
publishing

cloud rstudio server pro very important





    Make sure you are in a RStudio project dedicated to the blog.
    Add relativeURLS=true to config.toml
    Develop as normal using blogdown::serve_site()
    When you're ready to deploy, use the Build Pane's Build Website command.
    Click Publish from the built preview, and select "Publish finished website only"


---
name: yourturn-5
template: yourturn

.right-column[
# .fancy[05:00 minutes]
### Deploy!

1. `r emo::ji("cloud")` | `r emo::ji("computer")`
  + Use RStudio Connect

1. `r emo::ji("computer")` + <i class="fab fa-github fa-lg fa-fw"></i>
  + Add a `.gitignore`
  + Push your changes to GitHub
  + On Netlify.com, New Site from Git > pick your repo

]
---

`r emo::ji("newspaper")`

Extra Extra!

Want to change the landing page? You need to do two things:

1. add an `_index.md` file to `content/` (not in a subfolder)
1. update the `index.html` layout

Let's try it!

---

Update your theme if you want:

```{r eval = FALSE}
blogdown::install_theme("gcushen/hugo-academic", 
                        theme_example = TRUE, 
                        update_config = TRUE) #<<
```

