Thea » In-Depth

Thea requires 4 folders at the root of your project (see the starter kit for a practical example):


This is where your configuration file(s) live. The only required file within this directory is default.toml which is where you'll define your page types and template globals (see example file below).

You can optionally create a development.toml and/or production.toml file with environment-specific settings that'll be applied on top of default.toml, overwriting any matching keys. For example, you can set a base_url key in templates.globals to have a value of during local development, and a value of in production. Thea determines the environment via the THEA_ENV environment variable. If no value is found, Thea will assume it's in a development environment. Acceptable values are:

1# [1]: write_to_disk (default: false, required: false)
2# If true, Thea will write the contents of the HashMap to a .rendered/
3# directory in your project. This is only useful for utilities like purgecss.
4write_to_disk = true # [1]
6# [2]: path (default: "content", required: false)
7# The path to the directory that will hold your page type folders.
9# [3]: syntax_theme (default: "InspiredGitHub", required: false)
10# The theme Thea should highlight syntax with.
11# Available values:
12# * "base16-ocean.dark"
13# * "base16-eighties.dark"
14# * "base16-mocha.dark"
15# * "base16-ocean.light"
16# * "InspiredGitHub"
17# * "Solarized (dark)"
18# * "Solarized (light)"
20path = "content" # [2]
21syntax_theme = "Solarized (dark)" # [3]
23# [4]: content.page_types item (required: at least 1)
25# [5]: type (required: true)
26# A given name for the type that will be available in your template files
27# for things like filtering: {{ page.page_type }}.
29# [6]: path (required: true)
30# The folder within content/ where pages of this type live. In this case,
31# all files within content/posts/ will be assigned the "post" page type.
33# [7]: default_layout (required: true)
34# The name of the template file within templates/ that pages of this type
35# should default to if no "layout" key/value is present in their frontmatter.
36[[content.page_types]] # [4]
37type = "post" # [5]
38path = "posts" # [6]
39default_layout = "blogpost.html" # [7]
42type = "page"
43path = "pages"
44default_layout = "base.html"
47type = "spaceship"
48path = "spaceships"
49default_layout = "spaceship.html"
51# [8]: redirects item (required: false)
53# [9]: type (required: true)
54# Available values:
55# * "permanent"
56# * "temporary"
58# [10]: from (required: true)
59# The slug to be redirected.
61# [11]: to (required: true)
62# The slug to be redirected to.
63[[redirects]] # [8]
64type = "permanent" # [9]
65from = "/feed.xml" # [10]
66to = "/rss.xml" # [11]
69type = "temporary"
70from = "/about-me"
71to = "/about"
73# [12]: path (default: "templates", required: false)
74# The path to the directory that will hold your template files.
76path = "templates" # [12]
78# [13]: templates.globals (default: {}, required: false)
79# Global key/value pairs that are made available to your template files: {{ globals.base_url }}
80[templates.globals] # [13]
81base_url = ""
82title = "Elliot Jackson: Freelance software designer and developer"
83desc = "I'm Elliot Jackson; I build software for a living and write about Swift, Rust, and other things."
84something = "cool"


This is where you create the folders for your page types. If my project was using the default.toml file above, for example, I'd create the following folders:

A page type folder can contain any number of files and sub-directories, the only requirement being that every file must have a slug key in its frontmatter. Thea does not take directory structure into account when creating and matching slugs. You can create a content/pages/ file with slug: "/" frontmatter and when someone visits the root of your domain, that's the page that'll be matched.

Thea assigns the appropriate Content-Type header to slugs that have any of the following extensions:

If a slug doesn't have an extension, it'll be assigned a text/html Content-Type header. Slugs with extensions other than those listed will be assigned a text/plain Content-Type header.


This is where you should put image files, videos, etc. The contents of this directory isn't loaded into the HashMap but is accessible via Due to the performance strategies applied to pages served from the HashMap, you should favour creating an "assets" page type and keeping JavaScript & CSS files in your content/ folder.


This is where all your layout files live. Thea uses the brilliant Tera as a template engine and it, along with the global access to your content Thea provides, allows for some truly powerful templating.

Every template file has access to 3 top-level data sources:

A page consists of 4 key/values:

[Back to docs]