Websites Pt. 1

Session 2: AEA Replication in Quarto

Cynthia Huang

Tuesday, July 18, 2023

Websites are Projects

Anatomy of a Quarto Website

πŸ”— github.com/cynthiahqy/monash-quarto-aea

.
β”œβ”€β”€ 00-pre-workshop.qmd
β”œβ”€β”€ 01a-hello-quarto
β”‚   β”œβ”€β”€ images
β”‚   β”œβ”€β”€ index.qmd
β”‚   └── slides.qmd
...01d...04d...
β”œβ”€β”€ index.qmd
β”œβ”€β”€ about.qmd
β”œβ”€β”€ day01-exercises.zip
β”œβ”€β”€ images
β”‚   └── cynthia-profile.jpg
β”œβ”€β”€ _quarto.yml
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ README.qmd
β”œβ”€β”€ docs
β”‚   β”œβ”€β”€ 00-pre-workshop.html
β”‚   β”œβ”€β”€ 01a-hello-quarto
β”‚   β”œβ”€β”€ 01b-formats
β”‚   β”œβ”€β”€ 01c-articles
β”‚   β”œβ”€β”€ 01d-wrap-up
β”‚   β”œβ”€β”€ about.html
β”‚   β”œβ”€β”€ day01-exercises.zip
β”‚   β”œβ”€β”€ images
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ search.json
β”‚   └── site_libs
β”œβ”€β”€ _freeze
β”‚   β”œβ”€β”€ 00-pre-workshop
β”‚   β”œβ”€β”€ 01a-hello-quarto
β”‚   β”œβ”€β”€ 01b-docs
β”‚   β”œβ”€β”€ 01b-formats
β”‚   β”œβ”€β”€ 01c-articles
β”‚   └── site_libs
β”œβ”€β”€ references.bib
└── style
    └── slides.scss
  • Config File _quarto.yml with:
    • Project options
    • Website options
    • Shared document options
  • Multiple .qmd files
  • Additional assets such as code, data, images, pdfs, zip etc.
  • Rendered website ready for publishing

Quarto Projects…

are directories that provide:

  • A way to render all or some of the files in a directory with a single command (e.g. quarto render myproject).

  • A way to share YAML configuration across multiple documents.

  • The ability to redirect output artifacts to another directory.

  • The ability to freeze rendered output (i.e. don’t re-execute documents unless they have changed).

Projects types

Every project has a _quarto.yml config file:

_quarto.yml
project:
  type: website
  output-dir: docs
...

The type field indicates the type of project:

  • default: Collection of documents

  • website: Websites (and blogs)!

  • books: Books

We will focus on Websites.

Projects options for Websites

  • output-dir field controls where rendered output goes. Defaults to _site
_quarto.yml
project:
  type: website
  output-dir: docs
  render:
    - "index.qmd"
    - "about.qmd"
    - "00-pre-workshop.qmd"
    - "01*/*.qmd"
  resources:
    - "day01-exercises.zip"

Projects options for Websites

  • render: lists which files to render. Defaults to all files.
  • resources: specifies additional files that should be copied to the output directory.
_quarto.yml
project:
  type: website
  output-dir: docs
  render:
    - "index.qmd"
    - "about.qmd"
    - "00-pre-workshop.qmd"
    - "01*/*.qmd"
  resources:
    - "day01-exercises.zip"

See Render Targets and Site Resources in the Quarto Website Guide for more details.

Comments in .yml files

Use # to add comments.

_quarto.yml
project:
  type: website
  output-dir: docs
  ## which pages to include in the website
  render:
    - "index.qmd"
    - "about.qmd"
    - "00-pre-workshop.qmd"
    - "01*/*.qmd"
  ## non-page resources for your website
  resources:
    - "day01-exercises.zip"

Rendering Websites

πŸ”— github.com/cynthiahqy/monash-quarto-aea

.
β”œβ”€β”€ 00-pre-workshop.qmd
β”œβ”€β”€ 01a-hello-quarto
β”‚   β”œβ”€β”€ images
β”‚   β”œβ”€β”€ index.qmd
β”‚   └── slides.qmd
β”œβ”€β”€ index.qmd
β”œβ”€β”€ about.qmd
β”œβ”€β”€ day01-exercises.zip
...01d...04d...
...README...LICENSE...
β”œβ”€β”€ _quarto.yml
β”œβ”€β”€ _freeze/
β”œβ”€β”€ docs/
β”œβ”€β”€ references.bib
└── style
    └── slides.scss
_quarto.yml
project:
  type: website
  output-dir: docs
  render:
    - "index.qmd"
    - "about.qmd"
    - "00-pre-workshop.qmd"
    - "01*/*.qmd"
  resources:
    - "day01-exercises.zip"

Website Options

Available Features

  • Navigation: Top navbars, Sidebars
  • Tools: Search, Social Media, Comments, Google Analytics
  • Content: Listings, About Pages

For a full list of available options see quarto.org > Reference > Projects > Websites. Include these options under the website: field.

Your Turn: Website Options

Open up the workshop website. Pick a YAML option from below and figure out what it does. You might find these links useful: Website Navigation, Website Options. Compare with your neighbour.

10:00
website:
  title: "Meeting AEA Replication standards using Quarto and GitHub"
  description: "Jul 18-20 Workshop on Quarto for Department of Economics, Monash University"
  page-navigation: true
  page-footer:
  right: "This page is built with πŸ’š and [Quarto](https://quarto.org/)."
  left: "© Copyright 2023, Cynthia Huang"

  sidebar:
    pinned: true
    align: center
    style: docked
    search: true
    collapse-level: 2

    tools:
      - icon: github
        href: https://github.com/cynthiahqy/monash-quarto-aea
        text: "GitHub organization"

    contents:
      - href: index.qmd
        text: Home
      - href: about.qmd
        text: About
      - href: 00-pre-workshop.qmd
        text: Pre-work
      - text: "---"
      - section: "Getting to Know Quarto"
        contents:
          - href: 01a-hello-quarto/index.qmd
            text: Hello Quarto!

Our Turn: Rendering Quarto Replication Website

Your Turn: Customising your Replication Website

  • What happens if you add href link to the sidebar without specifying text?
  • How can we change the title of the sidebar?
  • What features or content would you like to add to the website?
10:00