Appendix B — Quarto Website
This note is a step-by-step guide to publishing on Quarto Pub with RStudio.
B.1 Installation
Install Quarto
Download Quarto: Go to Quarto website and download the installer for your operating system (Windows/macOS/Linux).
Run the Installer: Follow the prompts to install Quarto. This adds the
quarto
command-line tool to your system.
Install the Quarto R Package
- Open RStudio
- Install the Quarto R package by running the following command in the console:
install.packages("quarto")
- Restart RStudio to ensure the Quarto integration works properly.
Verify Installation
- Open the Terminal pane in RStudio (not Console).
- Type
quarto check
and press Enter. - Confirm that Quarto and required dependencies (e.g., Pandoc) are installed. Fix any issues if prompted.
Create a Quarto Pub Account
- Go to Quarto Pub and sign up for a free account.
- Verify your email to activate the account.
B.2 Quarto Publish with RStudio
Create a New Quarto Website Project
- In RStudio, go to File > New Project > New Directory > Quarto Website.
- Name your project (e.g.,
firstname-website
) and choose a save location (e.g., under yourdjr
folder). - Click Create Project: This generates a basic website template with
index.qmd
andabout.qmd
.
.Rproj
: RStudio project fileindex.qmd
: Homepage contentabout.qmd
: About page content_quarto.yml
: Site configuration settingsstyles.css
: Custom CSS styles
Edit Website Content
- Edit
index.qmd
to add content to your homepage. - Edit
about.qmd
to add an about page. - Modify the
_quarto.yml
file to configure site settings (title, navigation, theme).
Preview Your Website Locally
- Click the Render button in RStudio to preview your website.
Publish Your Website
Use your direction keys to navigate and select options, and press Enter
to confirm your choices.
- Open the Terminal pane in RStudio.
- Type
quarto publish
and press Enter. Provider?
: SelectQuarto Pub
as your publishing destination.- Authorize the connection to Quarto Pub.
Publishing with account?
: Confirm your Quarto pub account.Site name?
: Confirm your site name.- Follow the on-screen instructions to complete the publishing process.
View Your Published Website
- Once the publishing process is complete, your website will be live at
https://quartopub.com/yourusername/yourprojectname
. - Share the link with others to showcase your work!
B.3 Updating Quarto Website
B.4 Updating Content
- To update your website, make changes to your
.qmd
files and re-publish usingquarto publish
. Publish updates to:
Confirm site link and press Enter.- Your website will be automatically updated with the new content.
Website Structure
Let’s say if you want your website have 4 pages:
- Home page to show the content of
index.qmd
- About page to show the content of
about.qmd
Data Cleaning
to show the content ofdata-cleaning.qmd
Data Analysis
to show the content ofdata-analysis.qmd
First, in addition to the existing index.qmd
and about.qmd
, you need to create two new .qmd
files:
data-cleaning.qmd
data-analysis.qmd
.
Then, you need to modify the _quarto.yml
file to add the new pages to the navigation bar.
Open
_quarto.yml
in RStudio.Revise your
nav_bar
section to include the new pages:
nav_bar:
- text: Home
href: index.html
- text: About
href: about.html
- text: Data Cleaning
href: data-cleaning.html
- text: Data Analysis
href: data-analysis.html
- Save the
_quarto.yml
file. - Click the Render button in RStudio to preview your updated website.
- Publish your updated website using
quarto publish
.
Each .qmd file should be self-contained. This means: (1) Load all required packages using library()
at the top of each file. (2) Load any data needed directly in that file. Do not assume code from other .qmd files will run before this one.
B.5 Remove Quarto Webiste
- Go to your Quarto Pub account.
- Click on the project you want to delete.
- Click
Delete Site
to remove the website from Quarto Pub.