Link Search Menu Expand Document

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 add the following to your configuration:

{
  "plugins": ["@indiekit/preset-jekyll"],
  "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.

Path and URL tokens

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

Token Path/URL prefix 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, eq 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