How to Make a Blog

PSY 504: Advanced Statistics

Jason Geller, Ph.D.
Princeton University
January 31, 2024

Building a Website with Quarto

Software

  1. Github account
  2. Github Desktop
  3. R
  4. R Studio

Quarto Blog

  1. Open up R studio.

  2. Choose File -> New Project

  3. You should see a pop-up menu

  4. Choose “New Directory”

Create a new blog

Name Your Blog

Complie

Build

  1. Go to the “build” tab in the top right hand corner, and press “Render website”.

Preview

  1. You may see a preview of the website in the R Studio browser window, and you can click this little button to preview the blog in your default browser.

Writing Your Own Posts

I recommend learning to blog with quarto by opening and modifying the template files.

You can see all of the files in your project by clicking on the files tab:

New Post

  • To create a new post, copy an existing folder and name it something else

Index

  • Clicking on “index.qmd” should open the file in the R studio text editor (on the left)

  • Give it a new name and delete the default text

Re-render

You have made your first blog!

Share it on Github

  1. Open up Github Desktop

  2. Go to preferences and sign in to your Github.com account

  3. “Add” your blog project folder to Github Desktop

  4. Publish to github.com and uncheck private repository (if you want other people to see it.)

  5. You should now be able to see your new repository in your github.com profile, which means you should be able to see a copy of your blog files in the repository.

QMD Changes for Github Site

  • To change the output directory from _site to docs open up _quarto.yml, and add the line output-dir: docs just like this:
project:
  type: website
  output-dir: docs
  • Should see a new docs folder

  • Push your changes to github so that your repository, and activate the github pages option under your repository settings.

Config File

  • _quarto.yml

    • Metadata

      ``` {project:} output-dir: _output

      toc: true number-sections: true bibliography: references.bib

      format: html: css: styles.css html-math-method: katex pdf: documentclass: report margin-left: 30mm margin-right: 30mm ```

Github in RStudio

Github in RStudio

  • Get SSH key

Github in RStudio

You can do more!

  • Make new posts by copying an existing one.

  • Publish them by rendering the website on your computer, and pushing your changes to Github.com

Presentations

  • https://quarto.org/docs/presentations/

Make a Professional Website

  • https://quarto.org/docs/websites/