Fetching Qmd metadata from code to compile a list of articles? #5586
Replies: 3 comments 7 replies
-
You could do the other way around, write the spreadsheet and use it to fill/create the listing, see for example how I use "pre-render" script to build my publication listing out of a bib file: https://github.com/mcanouil/mickael.canouil.fr. |
Beta Was this translation helpful? Give feedback.
-
Sounds like a great project! I've been bumping into similar questions and I find there are two uses cases: how to centralize content from many qmds into a single file, and how to distribute content from one file to many qmds. It sounds like you're firmly in the centralizing use case. Just spitballing, but could you:
|
Beta Was this translation helpful? Give feedback.
-
Currently there isn't a clean API, but this is a totally reasonable request! I'm going to mark this for our quarto 1.5, where we're considering a revamp of project-wide rendering. Quarto will collect and reason much more explicitly about inputs and outputs, and providing a project-wide tabulation of document metadata is a natural thing in that context. I can't promise that we'll be able to do it, but it seems like it could have a number of other useful applications. In the meantime, if you want to collect this information as your website renders, you can add a Lua filter that operates on the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using the Quarto website format to build a repository of datasets for statistics courses. So each dataset has a Qmd file describing it, and I'm using the Listings feature to make a sortable page listing them all.
I'd like to add custom metadata to each Qmd, such as the year the data was collected, the number of variables, or the license of the data. I can display some of that in the listing, but it'd also be very useful to compile all that data into some kind of spreadsheet, so course instructors could quickly find datasets that meet their requirements (and so Quarto doesn't have to reinvent searching and sorting tabular data).
In principle this should be easy, since it's just YAML metadata in the headers of each Qmd. Is there a standard API for fetching the metadata of all articles that I could use from R or Lua? Then I could build the tool to export a spreadsheet easily. Failing that, is there a reason it wouldn't work to simply read all the Qmd files and their header YAML from a script, and use that to generate a CSV?
Beta Was this translation helpful? Give feedback.
All reactions