Listings from data

Example of how to generate listings for external blog posts

You don’t need to have blog posts to create a listing on a Quarto page. For example, you can combine the following three yaml files:

blog/_metadata.yml
listing: 
  max-description-length: 75
  date-format: short
  feed: true
  filter-ui: false
  type: table
  sort-ui: false
  sort: "date desc"
  categories: false
  fields: [date, name]
  field-links: [name]
  field-display-names:
    name: Title
format:
  html:
    anchor-sections: true

This file specifies a list of blog posts that you can have elsewhere

blog/blogs.yml
- name: "nbdev + Quarto: A new secret weapon for productivity"
  path: https://www.fast.ai/2022/07/28/nbdev-v2/
  date: 2022-07-28
  categories: [Jupyter, Quarto, nbdev]
  description: |
    Our favorite tool for software engineering productivity–nbdev, now re-written with Quarto.

- name: Notebooks in production with Metaflow
  path: https://outerbounds.com/blog/notebooks-in-production-with-metaflow/
  date: 2022-02-09
  categories: [Metaflow, Jupyter]
  description: |
   Introduces a new Metaflow feature that allows users to use notebooks in production ML workflows.

In the front matter of any page (like index.qmd) you can reference blogs.yml and _metadata.yml like so:

index.qmd
---
sidebar: false
description: "A collection of technical blogs and talks on machine learning and data science."
toc: true
metadata-files: 
  - blog/_metadata.yml
listing: 
  id: blog-listings
  contents: blog/blogs.yml
---

## Reference the listing somewhere on the page like this

Subscribe via RSS: [<i class="bi bi-rss"></i>](index.xml)

::: {#blog-listings}
:::
Overriding YAML configurations

You can override any option specified in metadata.yml by setting that after metadata-files. Things that come later in the front-matter will override any inherited files.

Results

This will generate a list of blog posts that you can see here on my page, this is in the table format. However, you can have pictures on your listing as well, which you can see from the Minimal Example.

Minimal Example

Here is a minimal example of creating an index page of all your blog posts. It uses slightly different options than I did in the above example. You can see the code for that here.

Resources