15:00
From R Markdown to Quarto
UC Berkeley
Duke University + Posit
Quarto projects have a _quarto.yml
file
The type
field in this file indicates the type of project:
default
: Collection of documents
website
: Websites (and blogs)
books
: Books
Websites are essentially format: html
+ a Quarto Project file
But a website is different than format: html
in that it has multiple pages
Websites are our first exploration into Quarto Projects
Websites and books are very similar in that they associate multiple pages/resources into a connected resource
Let’s build a website together from all of the documents we’ve created so far and highlight the following features of Quarto websites:
_quarto.yml
index.qmd
/ landing page / change landing page
Navigation
Freeze
Themes and dark theme toggle
Publishing to QuartoPub
An aspect of the workshop webpage that you fancy?
Pick up where we left off and
15:00
Let’s now add a blog component to our website.
Add a folder called posts
and create a few minimal blog post entries and collect these from a blog page using the listings feature.
Change the style of listings.
You might have a reason to re-run all code in a Quarto website (every single chunk in every single document) every time you render the website.
But, chances are, that’s not what you want.
Just playing around styling – you probably don’t want to run the code again
Changed some code in a document – you probably want to re-run the code in that document, but not necessarily others
Made a big change affecting computations on many or all pages – you probably want to re-run all code
freeze
and cache
options give you fine control over these decisions
freeze
option controls when/if computational documents be re-rendered during a global project render:The freeze
option is typically added to a _metadata.yml
file within a specific directory, affecting all files in that directory.
For blogs, set feeze
in _metadata.yml
at the root of the posts
directory.
You can have it only within specific subdirectories for more complex sites.
Cache stores the results of computations for a specific file.
Cache invalidation is triggered by changes in chunk source code (or other cache attributes you’ve defined).
cache
can also be set at the chunk level. Consider using the cache for computationally expensive chunks.
Freeze option is typically set
for the whole website in _quarto.yml
, or
for files within a directory in _metadata.yml
in that directory
or
Quarto Pub is a free publishing service for content created with Quarto. It is ideal for blogs, course or project websites, books, presentations, and personal hobby sites.
Publish with quarto publish
:
_publish.yml
that is safe to check into version control.Any questions / anything you’d like to review before we wrap up this module?