Created
February 15, 2023 04:36
-
-
Save jimjam-slam/e9325abcb7c07b64e1f6d7b6a6f88d03 to your computer and use it in GitHub Desktop.
Accessing custom, nested Quarto document metadata in other listings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project: | |
type: website |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Doc metadata test - index" | |
author: "James" | |
listing: | |
template: postlist.ejs | |
id: mylisting | |
contents: post*.qmd | |
--- | |
Here's a listing of _all_ my posts, with links and the list of people in each: | |
:::{#mylisting style="background-color: #eeeeee"} | |
::: | |
Listing over! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{=html} | |
<% for (const person of items) { %> | |
<h2><%= person.name %></h2> | |
<ul> | |
<% for (const link of person.links) { %> | |
<li><%= link %></li> | |
<% } %> | |
</ul> | |
<% } %> | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Doc metadata test - post 1" | |
listing: | |
template: post.ejs | |
id: mylisting | |
contents: | |
- name: James | |
links: | |
--- | |
My listing is going to go here: | |
:::{#mylisting style="background-color: #999999"} | |
::: | |
Listing over! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Doc metadata test - post 2" | |
listing: | |
template: post.ejs | |
id: mylisting | |
contents: | |
- name: Sam | |
links: | |
- pixabay | |
--- | |
My listing is going to go here: | |
:::{#mylisting style="background-color: #eeeeee"} | |
::: | |
Listing over! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{=html} | |
<h1>All people</h1> | |
<% for (const doc of items) { %> | |
<a href="<%= doc.path %>"><h2><%= doc.title %></h2></a> | |
<h3>People in this post:</h3> | |
<% for (const person of doc.listing.contents) { %> | |
<h4><%= person.name %></h4> | |
<ul> | |
<% for (const link of person.links) { %> | |
<li><%= link %></li> | |
<% } %> | |
</ul> | |
<% } %> | |
<% } %> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment