Link Search Menu Expand Document (external link)


A publication preset plug-in sets default values for post types and provides a post template for a given publication, static site generator, content management system or other publishing application.


Property Type Description
id String Kebab-cased plug-in ID. Required.
meta Function import.meta. Required.
name String Human readable plug-in name. Required.
options Object Plug-in options. Optional.


Property Type Description
info Object Information about the preset. Required.
postTypes Array Default values for post types.


Indiekit’s web interface expects a preset plugin to provide some information about the publication or content management system it supports. This is provided by the info property:

get info() {
  return {
    name: "Example application",

The info property returns the following values:

Property Type Description
name String The name of the publishing application the preset supports. Required.


Micropub clients let you publish a variety of post types. A publication preset defines the default values for these post types, which users can override in their configuration.

For example, to add default values for note and photo post types:

get postTypes() {
  return [
      "type": "note",
      "name": "Diary entry",
      "post": {
        "path": "diary/{yyyy}-{MM}-{dd}-{slug}.md",
        "url": "diary/{yyyy}/{MM}/{slug}"
      "type": "photo",
      "name": "Image entry",
      "post": {
        "path": "images/{yyyy}-{MM}-{dd}-{slug}.md",
        "url": "images/{yyyy}/{MM}/{slug}"
      "media": {
        "path": "media/images/{yyyy}/{filename}"

Each object in postTypes should return the following values as a String:

Name Description
type The IndieWeb post type. Required.
name The name you use for this post type on your own site. You needn’t specify this value, but some Micropub clients use it in their publishing interfaces. Required.
post.path Where posts should be saved in your content store. Required.
post.url Permalink (the URL path) for posts on your website. Required.
media.path Where media files should be saved in your content store. Required for photo, video and audio post types only.
media.url Public accessible URL for media files. This can use the same template variables as media.path. Optional, defaults to media.path.

Values for *.path and *.url can be customised using the following tokens:

Token Path type Description
y post media Calendar year, eg 2020
yyyy post media Calendar year (zero-padded), eg 2020
M post media Month number, eg 9
MM post media Month number (zero-padded), eg 09
MMM post media Month name (abbreviated), eg Sep
MMMM post media Month name (wide), eg September
w post media Week number, eg 1
ww post media Week number (zero-padded), eg 01
D post media Day of the year, eg 1
DDD post media Day of the year (zero-padded), eg 001
D60 post media Day of the year (sexageismal), eg 57h
d post media Day of the month, eg 1
dd post media Day of the month (zero-padded), eg 01
h post media Hour (12-hour-cycle), eg 1
hh post media Hour (12-hour-cycle, zero-padded), eg 01
H post media Hour (24-hour-cycle), eg 1
HH post media Hour (24-hour-cycle, zero-padded), eg 01
m post media Minute, eg 1
mm post media Minute (zero-padded), eg 01
s post media Second, eg 1
ss post media Second (zero-padded), eg 01
t post media UNIX epoch seconds, eg 512969520
T post media UNIX epoch milliseconds, eg 51296952000
uuid post media A random UUID
slug post Provided slug, slugified name or a 5 character string, eg ycf9o
n post Incremental count of posts (for type) in the same day, eg 1
basename media 5 character alpha-numeric string, eg w9gwi
ext media File extension of uploaded file, eg jpg
filename media basename plus ext, eg w9gwi.jpg
originalname media Original name of uploaded file, eg flower.jpg


Method Type Description
postTemplate() Function Default post template.


A post template takes post properties received and parsed by the Micropub endpoint and renders them in a given file format, for example, a Markdown file with YAML front matter.

The postTemplate() method takes one argument, properties, which contains the derived properties for a post, for example:

  published: '2020-02-02',
  name: 'What I had for lunch',
  content: 'I ate a cheese sandwich, which was nice.',

The postTemplate() method determines how this data will get transformed. For example, if you wanted to output a format used by Kirby, you might provide the following function:

postTemplate(properties) {
  let text;

  if (properties.published) {
    text += `\n---\nDate: ${properties.published}\n---`;

  if ( {
    text += `\n---\nTitle: ${}\n---`;

  if (properties.content) {
    text += `\n---\nText: ${properties.content}`;

  return text;

This would then generate the following file:

Date: 2020-02-02
Title: What I had for lunch
Text: I ate a cheese sandwich, which was nice.


export default class ExamplePreset {
  constructor() { = "example-preset";
    this.meta = import.meta; = "Example preset";

  get info() {
    return {
      name: "Example",

  get postTypes() {
    return [];

  postTemplate(properties) {}

  init(Indiekit) {

Example publication preset plug-ins:

  • @indiekit/preset-jekyll provides post types and a post template for Jekyll-based websites.

  • @indiekit/preset-hugo provides post types and a post template (that accepts an option for the type of front matter format to be used) for Hugo-based websites.