Install a theme
catsup install git_repo
Install a theme in global
catsup install git_repo -g
Update a installed theme
catsup install theme_name
List all themes installed
catsup themes
Catsup uses Jinja2 as a Template Engine.You need to learn it if you want to design your own theme.
You can learn how to design your theme by demo:
A catsup theme should look like
├── README.md <-------- how to install/customize your theme.Used in GitHub.
├── static <-------- static files
│ ├── css
│ │ ├── pygments_style.css <-------- catsup uses Pygments to highlight code
│ │ └── style.css
├── templates <-------- template files
│ ├── article.html
│ ├── page.html
├── filters.py <--------- filters defined by theme
└── theme.py <--------- meta file
Only article.html and page.html are required.
A demo meta file
name = 'sealscript'
author = 'Lyric'
homepage = 'https://github.com/whtsky/catsup-theme-sealscript'
pages = [
'404.html'
]
vars = {
"github": "whtsky",
}
A theme meta consists of :
By default, Catsup will render article.html for post, page.html for pagination, tag.html for tag page and archive.html for archive page. If you want to render more template(like 404.html), please add template’s name to pages.
Your theme may need some var that user defined in config file. But they may miss some var, so you need to give a default value in theme’s meta file.
If you want more:
Templatable variables are only accessed in specify templates.
Catsup has a build-in function: static_url
<link rel="stylesheet" href="{{ static_url("css/style.css") }}" type="text/css" />
Every function in filters.py will be a filter.Catsup also has some build-in filter:
Catsup has some powerful marco to make your job easier
Use them like
<html>
<head>
<title>{{ post.title }}</title>
{% from 'utils.html' import meta, analytics %}
{{ meta(post) }}
{{ analytics }}
</head>
<body>
<article>
<h1>{{ post.title }}</h1>
{{ post.content }}
{% from 'utils.html' import render_comment %}
{{ render_comment }}
</article>
</body>
</html>
This is a simple article.html template using catsup’s template marco.Isn’t that simple?