Documentation Configuring post types

Micropub clients let you publish a variety of post types, and Indiekit lets you decide how these different types are handled. You can do this by using a publication preset, configuring values manually, or a combination of both.

For example, to use the Jekyll preset but override the note and photo post types, you would use the following configuration:

import {JekyllPreset} from '@indiekit/preset-jekyll';

// Use a preset
const jekyll = new JekyllPreset();
indiekit.set('publication.preset', jekyll);

// Override preset post type
indiekit.set('publication.postTypes', [{
type: 'note',
name: 'Journal entry',
post: {
path: '_journal/{​yyyy}-{MM}-{dd}-{​slug}.md',
url: 'journal/{yyyy}/{MM}/{​slug}'
},
}, {
type: 'photo',
name: 'Photograph',
post: {
path: '_photos/{​yyyy}-{MM}-{dd}-{​slug}.md',
url: 'photos/{yyyy}/{MM}/{​slug}'
},
media: {
path: 'media/photos/{​yyyy}/{​filename}',
}
}]);

Each post type can take the following values:

  • type: The IndieWeb post type.

  • 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.

  • post.path: Where posts should be saved in your repository.

  • post.url: Permalink (the URL path) for posts on your website.

  • media.path: Where media files should be saved in your repository. This applies only to photo, video and audio post types.

  • media.url: Public accessible URL for media files. This can use the same template variables as media.path. If no value is provided, defaults to media.path.

Creating custom paths and URLs

Both path and url values can be customised using the following date tokens:

Token Description
y Calendar year, eg 2020
yyyy Calendar year (zero-padded), eg 2020
M Month number, eg 9
MM Month number (zero-padded), eg 09
MMM Month name (abbreviated), eg Sep
MMMM Month name (wide), eg September
w Week number, eg 1
ww Week number (zero-padded), eg 01
D Day of the year, eg 1
DDD Day of the year (zero-padded), eg 001
D60 Day of the year (sexageismal), eg 57h
d Day of the month, eg 1
dd Day of the month (zero-padded), eg 01
h Hour (12-hour-cycle), eg 1
hh Hour (12-hour-cycle, zero-padded), eg 01
H Hour (24-hour-cycle), eg 1
HH Hour (24-hour-cycle, zero-padded), eg 01
m Minute, eg 1
mm Minute (zero-padded), eg 01
s Second, eg 1
ss Second (zero-padded), eg 01
t UNIX epoch seconds, eg 512969520
T UNIX epoch milliseconds, eg 51296952000

The following template tokens are available for post paths and URLs:

Token Description
slug Provided slug, slugified name or a 5 character string, eg ycf9o
uuid A random UUID

The following template tokens are available for media file paths and URLs:

Token Description
basename 5 character alpha-numeric string, eg w9gwi
ext File extension of uploaded file, eg jpg
filename basename plus ext, eg w9gwi.jpg
originalname Original name of uploaded file, eg flower.jpg
uuid A random UUID