indiekit

Usage

Having deployed IndieKit to your own server, you’ll no doubt want to customise certain aspects of it. Configuration can be provided via a JSON file by providing a value for the INDIEKIT_CONFIG_PATH environment variable. This will let you customise where posts are saved, how they are formatted and what URLs they will appear at.

Configuration options

categories

A list of categories clients can expose in their publishing interface. Defaults to []. There are two ways of providing these values:

media-endpoint

The URL for your preferred media endpoint. Use this if you want another endpoint to respond to media upload requests. Defaults to https://<your-endpoint>/media.

syndicate-to

Information about syndication targets. Defaults to []. Example:

{
  "syndicate-to": [{
    "uid": "https://twitter.com/paulrobertlloyd/",
    "name": "Paul Robert Lloyd on Twitter"
  }, {
    "uid": "https://mastodon.social/@paulrobertlloyd",
    "name": "Paul Robert Lloyd on Mastodon"
  }, {
    "uid": "https://micro.blog/paulrobertlloyd",
    "name": "Paul Robert Lloyd on Micro.blog"
  }]
}

post-types

IndieKit provides a set of default paths and templates for the following post types:

These defaults can be ammended, and new types can be added. For example, to override the note and photo post types, you would provide the following:

{
  "post-types": {
    "note": {
      "name": "Micro note",
      "icon": ":memo:",
      "template": "_micropub/templates/note.njk",
      "post": {
        "path": "_notes/{​{ published | date('yyyy-MM-dd') }}-{​{ slug }}.md",
        "url": "notes/{​{ published | date('yyyy/MM') }}/{​{ slug }}"
      },
    },
    "photo": {
      "name": "Photograph",
      "template": "_micropub/templates/photo.njk",
      "post": {
        "path": "_photos/{​{ published | date('yyyy-MM-dd') }}-{​{ slug }}.md",
        "url": "photos/{​{ published | date('yyyy/MM') }}/{​{ slug }}"
      },
      "media": {
        "path": "media/photos/{​{ published | date('yyyy/MM') }}/{​{ filename }}",
      }
    }
  }
}

slug-separator

The character(s) to use when generating post slugs. Defaults to - (dash).

Creating custom paths and URLs

Both path and url values use Nunjucks templating to enable customisation, for which all properties provided in a Micropub request are available. To customise date values, the date() filter can be used. This accepts the formatting tokens offered by Luxon.

Creating templates

Like paths, templates use Nunjucks, and also accept any values provided in a Micropub request. Additional variables may be made available at a later date.

A few points to consider when creating templates: