Theme development

Typlog themes are powered by Jinja template language. And there is a command line tool serve-theme to help you developing Typlog themes.

Jinja

Jinja is a template language, if you are not familiar with Jinja, you can learn the syntax from the Template Designer Documentation.

You can also learn from one of your built-in theme source code:

Token

To develop your own theme, you need to grab an API token at first. You can create one in your account system. Click Tokens → New token to create one.

create token

NOTE: please select the theme scope before saving.

serve-theme

serve-theme is a command line tool which creates a localhost server to help developers designing the theme. Get the executable binary file from GitHub Releases, download the one matching your OS system and rename it to serve-theme. You can move the serve-theme file to one of your bin PATH.

Let's cd into the theme folder that you are going to develop and start the dev server with serve-theme:

$ export TOKEN=pt_xxxx # this token is created in preparation
$ export SITE=123 # find your site ID in Typlog
$ serve-theme # assume serve-theme is in PATH
2021/09/21 20:54:44 Listening . on port 7000

Now, you can visit http://localhost:7000/ to browser the theme you are designing.

Read more