This is the theme we use for OutOfCheeseError
- Start a blog using Pelican
- Clone this repository alongside your
pelicanconf.py
- Add the following options to
pelicanconf.py
. (the table of contents can be customized as desribed here)
THEME = "./astrochelys"
TAG_SAVE_AS = ''
AUTHOR_SAVE_AS = ''
CATEGORY_SAVE_AS = ''
PLUGINS = ['pelican-toc']
DIRECT_TEMPLATES = (('index', 'tags', 'categories', 'archives'))
Add margin and side notes to your articles by including raw HTML (which can be done in markdown, Jupyter notebook, and org-mode formats at least)
<label for="mn-note" class="margin-toggle">»</label>
<input type="checkbox" id="mn-note" class="margin-toggle"/>
<span class="marginnote">
your note here
</span>
and for a numbered side-note:
<label for="sn-note" class="margin-toggle sidenote-number"></label>
<input type="checkbox" id="sn-note" class="margin-toggle"/>
<span class="sidenote">
your note here
</span>
Change mn-note and sn-note to different names for each additional note (both in the label and the id)
Astrochelys supports both Google and Fathom analytics.
- To use Google Analytics, set the
GOOGLE_ANALYTICS
variable inpelicanconf.py
to your Analytics ID. - To use Fathom, set the
FATHOM_SITE_ID
variable to the site ID given by Fathom, and theFATHOM_ANALYTICS
variable to the server address performing the tracking (We use Fathom Lite hosted on Heroku for this, following the instructions here.)
Astrochelys provides comments using either Hypothesis or Disqus (or both). Disqus support is controlled by the variable DISQUS_SITENAME
in pelicanconf.py
. Hypothesis is embedded in the header and appears on the right side of the page.
Astrochelys supports search via tinysearch and some JS code taken from Matthias Endler’s blog source. To set this up:
- Install tinysearch and terser as described in the tinysearch repository
- Add a
json.md
file inyour_pelican_directory/content/pages
with
Title: JSON
Template: json
Slug: json
- Set the
ADD_SEARCH_BOX
variable toTrue
inpelicanconf.py
- Finally, add the following to your pelican
Makefile
:
.PHONY: index
index: content ## Build the search index with tinysearch
tinysearch --optimize --path $(OUTPUTDIR) $(OUTPUTDIR)/pages/json.html
.PHONY: minify
minify: ## Compress JavaScript assets
terser --compress --mangle --output $(OUTPUTDIR)/search_min.js -- $(OUTPUTDIR)/tinysearch_engine.js
.PHONY: build
build: html index minify ## Build static site and search index, minify JS
and, instead of running pelican content
to build your output files, run make build
instead.
- All website colors and fonts are defined in the first few lines of
static/css/astrochelys.css
, change these for a different theme. The modified fonts need to be downloaded from Google Fonts in the Fonts section of the<head>
instatic/templates/base.html
- Syntax highlighting colors are defined in
static/css/pygments.css
. Change this to any pygments theme you like. If your syntax theme needs a non-white background, addbackground: <color>
to thepre, pre code
section inastrochelys.css
. You can then probably remove the border since the color already demarcates the code block. - Change the sidebar color by changing the
background
variable in the.sidebar
section ofastrochelys.css
.
Every line of code in excruciating detail over at this post.