05:00
Session 3: Producing and Publishing Websites
Wednesday, July 19, 2023
Websites are collections of Quarto documents
but the Render button in Rstudio prioritises rendering and previewing the currently open document.
index.qmd and press Render. Where does the output go?05:00
For a full list of available options see quarto.org > Reference > Projects > Websites. Include these options under the website field in _quarto.yml
Top Nav bars can have items on the left or right, and include drop-down menus:
Sidebars are useful for sites with more files and deeper hierarchies, and can be split into sections:
Sidebars can also be built automatically using the title filed of all documents in the website project:
Open the website we just made.
posts/ and add file1.qmd and file2.qmd inside.file1.qmd and file2.qmd10:00
Global options can apply to all formats or specific formats, just like in a YAML header inside a .qmd file.
To reuse YAML options for files within a given folder (i.e. a collection of blog posts), include a _metadata.yml file in the folder along with the .qmd files:
The format of _metadata.yml is the same as _quarto.yml.
_metadata.yml
If you comment out an option in _metadata.yml, if there is a project level option in _quarto.yml it will apply. Otherwise the built in Quarto default applies.
In addition to the previous two options, you might have options you want to use across multiple files or folders but not for the whole project.
You can include these via the metadata-files: option. For example:
Recall that Quarto has built in defaults for YAML metadata fields. These are merged with any options that you provide, with the most specific taking priority:
| File | Role |
|---|---|
_quarto.yml |
Project level default options |
dir/_metadata.yml |
Directory level default options (overrides project) |
dir/document.qmd |
Document options (overrides directory and project) |
quarto.org/docs/projects/quarto-projects.html#shared-metadata
Open your last quarto project.
_metadata.yml file to the posts/ folder.05:00
The project configuration file _quarto.yml contains:
project:website:.qmd files targeted for rendering (defaults to all files). These can be for all formats or format specific.To re-render all targets in a project, run this in the Console:
Just like in YAML headers, YAML config files contain key-value pairs that must be indented correctly:
Just like in YAML headers, YAML config files contain key-value pairs that must be indented correctly:
_quarto.yml
We can add comments to .yml files using #.
We can share metadata options using:
_quarto.yml_metadata.yml, which follow the same schema as _quarto.ymlmetadata-files: fieldThe most specific options take priority – i.e.
document > directory > project > defaults