Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Blog Plugin

Basic usage

First, ensure your blog posts are defined in the table of contents of your myst.yml file:

project:
  toc:
    - pattern: posts/**/*.md

List the blog posts in a folder with the following directive:

MyST Demo
% By default, the plugin looks for markdown files in a `posts` directory
:::{blog-posts}
:::


Hello again!

I’m also a blog post

Date: 2025-02-01

Hello world!

I’m a blog post

Date: 2025-01-01

Custom paths with glob patterns

The :path: option supports glob patterns, allowing you to organize posts in subfolders. For example, to include all markdown files in any subfolder:

This is useful when organizing posts by year or category:

posts/2024/post-one.md
posts/2025/post-two.md

Limit the number of posts

You can limit the number of posts displayed:

Table view

For blogs with many posts, you can use a more compact table layout instead of cards:

MyST Demo
:::{blog-posts}
:kind: table
:path: posts/**/*.md
:::


TitleDate
A newer post from 20252025-03-01
Hello again!2025-02-01
Hello world!2025-01-01
An older post from 20242024-12-15

By default, the table displays title and date columns. The title column is automatically linked to the post.

Custom table columns

You can customize which frontmatter fields to display as columns using the :table-columns: option:

MyST Demo
:::{blog-posts}
:kind: table
:table-columns: title, date, subtitle
:path: posts/**/*.md
:::


TitleDateSubtitle
A newer post from 20252025-03-01Also in a subfolder
Hello again!2025-02-01I'm also a blog post
Hello world!2025-01-01I'm a blog post
An older post from 20242024-12-15Testing subfolder organization

Or reverse the date:

MyST Demo
:::{blog-posts}
:kind: table
:table-columns: date, title, subtitle
:path: posts/**/*.md
:::


DateTitleSubtitle
2025-03-01A newer post from 2025Also in a subfolder
2025-02-01Hello again!I'm also a blog post
2025-01-01Hello world!I'm a blog post
2024-12-15An older post from 2024Testing subfolder organization

Any frontmatter field can be used as a column!

Sorting posts

You can customize sorting with the :sort: option. This takes a form like:

:::{blog-posts]
:sort: [column]-[asc/desc]
:::

Where [column] is a field in each post’s YAML metadata, and asc/desc corresponds to alphanumeric sort ascending or descending. Omitting the -[asc/desc] will default to -asc. For example:

MyST Demo
:::{blog-posts}
:sort: title
:kind: table
:path: posts/**/*.md
:::


TitleDate
A newer post from 20252025-03-01
An older post from 20242024-12-15
Hello again!2025-02-01
Hello world!2025-01-01
MyST Demo
:::{blog-posts}
:sort: title-desc
:kind: table
:path: posts/**/*.md
:::


TitleDate
Hello world!2025-01-01
Hello again!2025-02-01
An older post from 20242024-12-15
A newer post from 20252025-03-01

Posts with missing values for the sort field are placed at the end.