Frontmatter is a way to add metadata to a Pluto.jl notebook, such as the title, description, authors, cover image, license, date and more. This data is used when sharing notebooks online, using Pluto HTML exports, PlutoUI.NotebookCard, PlutoSliderServer, PlutoPages or pluto.land.
PlutoUI.NotebookCard
For example, the featured notebooks use frontmatter. When you see the list of all featured notebooks, notice how they all have a title, description, cover image and authors. And they are
When editing a Pluto notebook, you can open the frontmatter editor by clicking the โShare buttonโ in the top right.
In the share menu, click the icon to open the frontmatter editor.
Here is a screenshot of the frontmatter editor. Scroll down to see more.
In this editor, you can edit fields and add new fields. You are free to enter any data that you want (which you might want to use in your custom scripts), but some frontmatter entries have special meaning in the Pluto ecosystem.
The following keys have special meaning:
title
<title>
description
<meta name="description" content="...">
image
date
license
tags
layout
order
The following keys are used as Open Graph (OG) tags in Pluto.jl HTML exports (using <meta property="og:...">):
<meta property="og:...">
title, type, description, image, article:tag, url, audio, video, site_name, locale, locale:alternate, determiner.
type
article:tag
url
audio
video
site_name
locale
locale:alternate
determiner
Setting these values helps with sharing notebooks on social media and search engine optimization.
author
There is also a vector author that is used to provide the authors of the notebook. The following fields have special meaning in the Pluto ecosystem:
name
If you are using PlutoPages.jl to write your website, you should at least set the following frontmatter entries for every page: layout and tags. (layout is the name of the layout file in the src/_includes/ directory.)
src/_includes/
If you are writing a featured notebook, check out other featured notebook files to see which frontmatter entries are required.
If you are writing a script to process Pluto notebooks, you can access the frontmatter data using the Pluto.frontmatter function. This function takes a notebook path as an argument, and returns a Dict with the frontmatter data.
Pluto.frontmatter
Dict
path = "/path/to/notebook.jl" frontmatter = Pluto.frontmatter(path) @info "Written by" frontmatter["author"]