format: html
+ a Quarto Projectformat: html
in that it has multiple pagesNo 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
Limited and gated at Medium.com
https://medium.com/towards-data-science/a-gentle-guide-to-statistics-in-r-ccb91cc1177e
vs
Full control at on my own page
https://themockup.blog/posts/2018-12-10-a-gentle-guide-to-tidy-statistics-in-r/
RStudio > New Project > New Quarto Blog
$ quarto create-project MyBlogName --type website:blog
Creating project at myblog:
- Created _quarto.yml
- Created index.qmd
- Created posts/welcome/index.qmd
- Created posts/post-with-code/index.qmd
- Created about.qmd
- Created styles.css
- Created posts/_metadata.yml
File | Description |
---|---|
_quarto.yml |
Quarto project file. |
index.qmd |
Blog home page. |
about.qmd |
Blog about page. |
posts/ |
Directory containing posts |
posts/_metadata.yml |
Shared options for posts |
styles.css |
Custom CSS for website |
posts
directory/posts
- this folder will be the “slug” URL (like themockup.blog/2022-07-25-new-post/
)index.qmd
within the new folderThese will preview the entire website
quarto render
on a specific post - this will just render that specific postWhen you render the website, it will re-execute code in older posts. Not ideal in many situations!
index.qmd
together!You can use the freeze option to denote that computational documents should never be re-rendered during a global project render, or alternatively only be re-rendered when their source file changes
freeze: true
is typically added to a _metadata.yml
file within a specific directory, affecting all files in that directory.
In the case of a blog - the _metadata.yml
is saved at the root of the posts
directory. You can have it only within specific subdirectories for more complex sites.
Cache on the other hand, stores the results of computations for a specific file.
Note that cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
I typically use cache throughout various types of outputs when I have computationally expensive chunks. Think a tidymodels
workshop website that is demo’ing with grid-tuning.
Add a _metadata.yml
to the /posts/
directory
Add the freeze code to _metadata.yml
Render index.qmd
in the project directory and note the items that are built
Explore the _freeze
directory
https://quarto.org/docs/websites/website-blog.html#themes
default, cerulean, cosmo, cyborg, darkly, flatly, journal, litera, lumen, lux, materia, minty, morph, pulse, quartz, sandstone, simplex, sketchy, slate, solar, spacelab, superhero, united, vapor, yeti, zephyr
_quarto.yml
and change the theme to one of the support Bootswatch themes/posts/
- title it 2022-07-26-my-first-post
index.qmd
in that folder, add a format: html
YAML header![]()
, along with maybe some code :laptop:---yaml
twitter-card:
image: images/profile-preview.png
creator: "@thomas_mock"
open-graph: true
title: "Tom Mock"
image: images/profile-preview.png
about:
template: trestles
links:
- icon: twitter
text: Twitter
href: https://twitter.com/thomasmock
- icon: github
text: Github
href: https://github.com/jthomasmock
---
about.qmd
)your-proj/index.qmd
becomes your “home page”blogdown
users might be used to/prefer your landing page being your “about me” pageindex.qmd
-> blog.qmd
and about.qmd
-> index.qmd
Type | Description |
---|---|
default | A blog style list of items. |
table | A table of listings. |
grid | A grid of listing cards. |
grid
index.qmd
Sometimes you might want to build out your own listing and link to arbitrary content rather than specific rendered file.qmd
index.qmd
YAMLlisting:
- id: etl
contents: "etl.yml"
type: grid
grid-columns: 2
image-height: 100px
- id: modeling
contents: "modeling.yml"
type: grid
image-height: 100px
grid-columns: 2
- id: pins
contents: "pins.yml"
type: table
field-display-names:
subtitle: "Description"
date-modified: "Last Updated"
- id: api
contents: "api.yml"
type: default
image-align: left
image-height: 75px
- id: apps
contents: "apps.yml"
type: default
image-align: left
image-height: 75px
---
Destination | Description |
---|---|
GitHub Pages | Publish content based on source code managed within a GitHub repository. Use GitHub Pages when the source code for your document or site is hosted on GitHub. |
RStudio Connect | Publishing platform for secure sharing of data products within an organization. Use RStudio Connect when you want to publish content within an organization rather than on the public internet. |
Netlify | Professional web publishing platform. Use Netlify when you want support for custom domains, authentication, previewing branches, and other more advanced capabilities. |
Other Services | Content rendered with Quarto uses standard formats (HTML, PDFs, MS Word, etc.) that can be published anywhere. Use this if one of the methods above don’t meet your requirements. |
quarto
CLI: quarto publish DESTINATION DOCUMENT.QMD
quarto
R package: quarto::quarto_publish_???()
Evaluate R/Python code and render on a schedule
RStudio Connect
rsconnect::deployDoc(quarto = "path/to/quarto")
rsconnect::deployDoc(quarto = quarto::quarto_path())
quarto::quarto_publish_???()
quarto_publish_site(server = "rstudioconnect.example.com")
quarto_publish_doc(server = "rpubs.com")
quarto_publish_app(server = "shinyapps.io")
quarto publish DESTINATION DOCUMENT.QMD
quarto publish netlify document.qmd
quarto publish gh-pages document.qmd
quarto publish connect document.qmd
index.qmd
to generate index.html
-> Push to GitHub
Step 2: Name your slides index.qmd pic.twitter.com/wLXN43rUlZ
— Emil Hvitfeldt (@Emil_Hvitfeldt) July 21, 2022
In your blog project:
quartopub.com
Similar to blog, but less of a focus on listing/posts and more focus on individual pages and overall navigation.
website:
title: "Get Started with Quarto"
twitter-card:
card-style: summary_large_image
description: "rstudio::conf-2022 2 day workshop on getting started with Quarto"
image: "https://raw.githubusercontent.com/rstudio-conf-2022/get-started-quarto/main/preview.jpeg"
page-footer:
left: "This page was built with ❤️ and [Quarto](https://quarto.org/) by [Tom Mock](https://themockup.blog)."
navbar:
background: "#447099"
left:
- href: index.qmd
text: Home
- text: Day 1
menu:
- href: materials/01-intro-quarto.qmd
text: "Intro to Quarto"
- href: materials/02-authoring.qmd
text: "Authoring Quarto"
- href: materials/03-computation-editors.qmd
text: "Code and Editors"
- href: materials/04-static-documents.qmd
text: "Static Documents"
When you create a project, a _quarto.yml config file is created. Here is an example of what the _quarto.yml looks like:
_quarto.yml
A typical project is used to:
The structure of a Quarto book can be as simple as a list of chapters, or can alternatively incorporate multiple parts and/or appendices. Quarto book chapters and sections are automatically numbered (for cross-referencing), however you can also specify that some parts of the book should remain unnumbered.
project:
type: book
book:
title: "mybook"
author: "Jane Doe"
date: "8/18/2021"
chapters:
- index.qmd
- intro.qmd
- summary.qmd
- references.qmd