+ - 0:00:00
Notes for current slide
Notes for next slide

Settle down a Personal Website

with and R Blogdown

Annie Lyu & Anabelle Laurent


Graphics Group Meeting @ISU
Workshop @R-Ladies-Ames

2020-04-03

1 / 30

Why a personal website?

2 / 30

Why a personal website?

2 / 30
3 / 30
4 / 30
5 / 30

How to get it done?

  1. customize your content by modifying a template website -- lots of work 😅

    • install.packages("blogdown")

    • blogdown::install_hugo()

6 / 30

How to get it done?

  1. customize your content by modifying a template website -- lots of work 😅

    • install.packages("blogdown")

    • blogdown::install_hugo()

  2. custom domain name -- straightforward 😄

    • Google Domains (.com, .org, .me) for a cost of $12 per year

    • Google Analytics (monitor website traffic for free)

6 / 30

How to get it done?

  1. customize your content by modifying a template website -- lots of work 😅

    • install.packages("blogdown")

    • blogdown::install_hugo()

  2. custom domain name -- straightforward 😄

    • Google Domains (.com, .org, .me) for a cost of $12 per year

    • Google Analytics (monitor website traffic for free)

  3. publish with GitHub and Netlify -- somewhat tricky 😣

    • tell Netlify to continuously build and deploy your website from source

    • configure custom domain DNS

6 / 30

RStudio and Website using blogdown

New Project New Directory Website using blogdown

7 / 30

RStudio and Website using blogdown

New Project New Directory Website using blogdown

8 / 30
9 / 30

Your Turn (2min)

  • Create a new website using the RStudio dialog to set it up in a new project.

    • pick a hugo theme you like (we'll use hugo-academic as an example)
  • Live preview a website locally (Addins -> Serve Site).

10 / 30

File structure (VERY IMPORTANT!!!)

  • configuration: a few site settings to go through

    • config.toml

    • config/_default/*.toml languages, menus, params

11 / 30

File structure (VERY IMPORTANT!!!)

  • configuration: a few site settings to go through

    • config.toml

    • config/_default/*.toml languages, menus, params

  • content: mostly markdown files

    • home/*.md -- homepage widgets

    • authors/admin -- your biography

    • post, talk, project, publication -- your achievements 💯

11 / 30

File structure (VERY IMPORTANT!!!)

  • configuration: a few site settings to go through

    • config.toml

    • config/_default/*.toml languages, menus, params

  • content: mostly markdown files

    • home/*.md -- homepage widgets

    • authors/admin -- your biography

    • post, talk, project, publication -- your achievements 💯

  • static: self imported files

    • images, slides, resume, etc.
11 / 30

File structure (VERY IMPORTANT!!!)

  • configuration: a few site settings to go through

    • config.toml

    • config/_default/*.toml languages, menus, params

  • content: mostly markdown files

    • home/*.md -- homepage widgets

    • authors/admin -- your biography

    • post, talk, project, publication -- your achievements 💯

  • static: self imported files

    • images, slides, resume, etc.
  • DO NOT TOUCH: public, resources, themes

11 / 30

Homepage Widgets (content/home)

12 / 30

Homepage Widgets (content/home)

  • active = true: keep widget; active = false: discard widget

  • weight

    • display order (small weight shows first)

    • works in the same way for both homepage widgets and navigation bar menus

For example, content/home/accomplishments.md

+++
# Accomplishments widget.
widget = "accomplishments"
headless = true # This file represents a page section.
active = false # Activate this widget? true/false
weight = 50 # Order that this section will appear.
13 / 30

Biography (content/authors/admin)

  • folder name admin can be replaced with a customized user name

  • edit authors/admin/_index.md to introduce yourself

  • replace authors/admin/avatar.jpg with your profile picture

14 / 30

Biography (content/authors/admin/_index.md)

15 / 30

Resources - icons

  • "<i class="fab fa-r-project"></i>" versus "r icon::fa('r-project')"

  • Fontawesome

16 / 30

Your turn (2min)

  • Fill in your information (at least name, organization and role)

Optional

  • Activate/deactivate the sections (widgets) on the homepage

  • Rearrange the section orders however you like

17 / 30

Create a new R Markdown post (content/post)

  • use the New Post Addin (or run blogdown::new_post(ext = '.Rmd'))
18 / 30

Create a new R Markdown post (content/post)

Do not knit your post, instead

  • use the Serve Site Addin to preview your post, or

  • refresh preview

In YAML header,

  • draft:TRUE preview an R markdown post

  • draft:FALSE ready to deploy a post

19 / 30

Resources - Highlight (config/_default/params.toml)

highlight = true
highlight_languages = ["r"]
highlight_style = "arta"
20 / 30

Resources - Emoji 😎

  • ":sunglasses:" versus "r emo::ji('sunglasses')"

  • Cheat sheet

21 / 30

Resources - Shortcodes

22 / 30

Import files (static)

For image not created from your R Markdown file, you should

  • add image to the static/img folder

  • insert your image using ![alternate-text](img/xx.png)

23 / 30

Import files (static)

For image not created from your R Markdown file, you should

  • add image to the static/img folder

  • insert your image using ![alternate-text](img/xx.png)

Any files in the static folder can be referred using similar relative path!

23 / 30

Import files (static)

For image not created from your R Markdown file, you should

  • add image to the static/img folder

  • insert your image using ![alternate-text](img/xx.png)

Any files in the static folder can be referred using similar relative path!

Follow the following steps to link your resume to the navigation bar:

  1. add your resume to the static/files folder

  2. Specify the URL to your resume in config/_default/menus.toml

[[main]]
name = "Resume" # displayed text
url = "files/resume.pdf"
weight = 70
23 / 30
  • relative path will be after your domain name (e.g., https://xxx.com/),

    • homepage section (widget): [text](#posts)

    • tags: [text](tags/rstats)

    • categories [text](categories/r)

24 / 30
  • relative path will be after your domain name (e.g., https://xxx.com/),

    • homepage section (widget): [text](#posts)

    • tags: [text](tags/rstats)

    • categories [text](categories/r)

  • DO NOT leave out prefix https:// when directing visitor to external webpages.

24 / 30
  • relative path will be after your domain name (e.g., https://xxx.com/),

    • homepage section (widget): [text](#posts)

    • tags: [text](tags/rstats)

    • categories [text](categories/r)

  • DO NOT leave out prefix https:// when directing visitor to external webpages.

  • Recommended practice for generating permanent links in config.toml

    • slug serves as a short page ID

    • URL won't change as you move around or rename file/folder

# Rules to generate permanent links of your pages
[permalinks]
post = "/:year/:month/:day/:slug/"
publication = "/publication/:slug/"
talk = "/talk/:slug/"
24 / 30

Create a new publication (content/publication)

25 / 30

Create a new publication (content/publication)

Per publication folder, you need

  • a Markdown file index.md
  • an optional featured image featured.png
  • an optinal citation cite.bib
26 / 30

Your Turn (2min)

  • Create a "hello world" post

  • Preview your post

Optional

  • Try inserting

    • code chunk

    • emoji

    • icon

    • image

    • hyperlink to internal pages

27 / 30

Additional Site configurations

  • config/_default/params.toml

    • your contact information (if you activate content/home/contact.md)

    • site name and description title and description

    • custom domain and Google analytics baseurl and google_analytics

    • active comments comments

  • config.toml

    • enable emoji enableEmoji = true

    • activate Chinese/Japanese/Korean languages hasCJKLanguage = true

28 / 30

Deploy with Netlify and GitHub

  • Push your repository to GitHub

    • can be private and ignore the public folder
29 / 30

Deploy with Netlify and GitHub

  • Push your repository to GitHub

    • can be private and ignore the public folder
29 / 30

Thank you

I get out of my pod 😆

30 / 30

Appendix

30 / 30

Resources - citation

  • use bibtex format. Open cite.bib on BibDesk
30 / 30

Public GitHub Repositories of Blogdown Website

30 / 30

Why a personal website?

2 / 30
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow