Skip to content

Theme Creation

Ram Kaniyur edited this page Nov 22, 2017 · 1 revision

Themes are just Git repositories with a tree like this:

  • assets/
    • Images, CSS, etc.
  • templates/
    • index.html
    • archive.html
    • post.html
    • Other templates.
  • Other files, such as README.md.

Assets

The assets folder is copied as out/assets during the build step.

Templates

Templates are written in Tenjin. Each template has a specific set of variables passed to it, as documented below.

index.html

  • config: { ... } - the contents of Leven.toml.
  • posts: [{ content, title, date, slug }] - the config.recents most recent posts, from newest to oldest.

archive.html

  • config: { ... } - the contents of Leven.toml.
  • posts: [{ content, title, date, slug }] - every single post, from newest to oldest.

post.html

  • config: { ... } - the contents of Leven.toml.
  • post: { content, title, date, slug } - the post currently being rendered.
  • prev: { content, title, date, slug } - the previous post.
  • next: { content, title, date, slug } - the next post.

Note: Dates have an iso8601 property that formats the date into an ISO 8601 string, rather than a user-formatted string. This can be used for client-side scripts.

Clone this wiki locally