You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/blog/index.qmd
+91Lines changed: 91 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,10 @@
1
1
---
2
2
title: Listings (e.g., blog)
3
3
listing:
4
+
- id: simple
5
+
contents: examples
6
+
type: grid
7
+
grid-columns: 3
4
8
- id: links
5
9
contents: links_real.yml
6
10
template: links.ejs
@@ -15,6 +19,93 @@ There are two ways to use listings:
15
19
16
20
## Listing of pages
17
21
22
+
### Simple listing of pages
23
+
24
+
A common use case is a blog or "Projects" page that lists documents from a folder. We create it with `listing:` in the YAML. At a minimum, you specify `contents`, which determines which documents to include.
25
+
26
+
For example, this will create a listing from files within the `pages/` folder:
27
+
28
+
```{.markdown}
29
+
---
30
+
title: Projects
31
+
listing:
32
+
contents: pages
33
+
---
34
+
```
35
+
36
+
In this example, we have add more criteria:
37
+
38
+
*`type:` how to display the items (for example, `default` list or `grid`).
39
+
*`grid-columns:` number of columns when using a grid layout.
40
+
*`fields:` which pieces of metadata to show for each item (for example, `title`, `subtitle`, `image`).
41
+
*`image-height:` how tall to show any image field.
42
+
43
+
```{.markdown}
44
+
---
45
+
title: Projects
46
+
listing:
47
+
contents: pages
48
+
type: grid
49
+
grid-columns: 3
50
+
fields: [title, subtitle, image]
51
+
image-height: "100"
52
+
---
53
+
```
54
+
55
+
Example:
56
+
57
+
::: {#simple}
58
+
:::
59
+
60
+
### Grouped listing of pages
61
+
62
+
You can also define **multiple listings** on the same page and group them.
63
+
64
+
This approach assumes that the pages in `pages/` have a `year:` field in their YAML. Each listing block uses `include:` to filter by `year`, and an `id` that matches a placeholder div later in the document.
65
+
66
+
```{.markdown}
67
+
---
68
+
title: Projects
69
+
listing:
70
+
- id: projects-2026
71
+
contents: pages
72
+
include:
73
+
year: 2026
74
+
fields: [title, subtitle, image]
75
+
76
+
- id: projects-2025
77
+
contents: pages
78
+
include:
79
+
year: 2025
80
+
fields: [title, subtitle, image]
81
+
82
+
- id: projects-2024
83
+
contents: pages
84
+
include:
85
+
year: 2024
86
+
fields: [title, subtitle, image]
87
+
88
+
format:
89
+
html:
90
+
page-layout: article
91
+
---
92
+
93
+
## 2026
94
+
95
+
::: {#projects-2026}
96
+
:::
97
+
98
+
## 2025
99
+
100
+
::: {#projects-2025}
101
+
:::
102
+
103
+
## 2024
104
+
105
+
::: {#projects-2024}
106
+
:::
107
+
```
108
+
18
109
## Listing of external things
19
110
20
111
**Note:** This is more advanced. The approach is based on `quarto-dev/quarto-web`'s gallery ([link](https://github.com/quarto-dev/quarto-web/blob/main/docs/gallery/gallery.ejs)).
0 commit comments