10:00
Session 4: More Quarto for Academics
Thursday, July 20, 2023
.qmd
files or a YAML listingsA listing can be included on any page by adding the listing
key into the YAML header:
---
title: "A page with a Listing"
listing:
contents: # ADD items #
type: # PICK default / grid / table #
---
contents
controls what items appear in the listingtype
controls how the listing is displayedIn addition to contents
and type
, other listings options include:
sort
, filter
categories
include
/exclude
sort-ui
, filter-ui
id
See Website Reference > Listings for all options.
Items for listings can be created using metadata from:
.qmd
files in the same folder as the listing pageQuarto offers 3 built-in display type
s for listings:
default
: blog style with featured imagegrid
: card style with featured imagetable
: table styleSee also:
To populate listings, Quarto uses metadata or content from targeted documents. Each listing types displays some fields by default:
Field | Default | Table | Grid |
---|---|---|---|
title |
x | x | x |
subtitle |
x | ||
author |
x | x | x |
description |
x | x | |
date |
x | x | x |
image |
x | x |
To display fields which are not shown by default, specify additional fields in the fields
option:
To modify the display name of fields, provide a mapping from the field key:
Reopen the fresh-web
website project.
Add a listing page for contents in the folder posts/
:
Important
Don’t forget to add posts/index.qmd
to your website navigation!
10:00
We can also list items from a YAML file:
people.yml
Just like with navbar items, listing items must be properly indented
We can created a listing from multiple sources of metadata:
To specify the position of a listing use the id
option:
people.yml
or definitions.yml
)title
, description
and one custom field (e.g. email
or definition
)index.qmd
with a suitable type.id
option15:00
The categories feature allows website users to filter items.
When a user presses a category on the right, the listing will update to show only items which match that category.
By default, items will be sorted by title
. To modify this use the sort
option.
This listing sorts items first by date
in ascending order then by descending title
By default, users can:
title
, date
and author
Continue with the YAML listing you created before.
categories
to each itemsort-ui
and/or filter-ui
10:00