Skip to content

out-of-cheese-error/astrochelys

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

The Astrochelys Pelican Theme

This is the theme we use for OutOfCheeseError

Basic Usage

  1. Start a blog using Pelican
  2. Clone this repository alongside your pelicanconf.py
  3. 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'))

Customizations

Margin notes and Side notes

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">&raquo;</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)

Analytics

Astrochelys supports both Google and Fathom analytics.

  • To use Google Analytics, set the GOOGLE_ANALYTICS variable in pelicanconf.py to your Analytics ID.
  • To use Fathom, set the FATHOM_SITE_ID variable to the site ID given by Fathom, and the FATHOM_ANALYTICS variable to the server address performing the tracking (We use Fathom Lite hosted on Heroku for this, following the instructions here.)

Comments

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.

Search

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 in your_pelican_directory/content/pages with
Title: JSON
Template: json
Slug: json
  • Set the ADD_SEARCH_BOX variable to True in pelicanconf.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.

Colors & Fonts

  • 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> in static/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, add background: <color> to the pre, pre code section in astrochelys.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 of astrochelys.css.

More

Every line of code in excruciating detail over at this post.

About

A Pelican theme with a sidebar, margin notes, search, and colors based on code highlighting

Topics

Resources

License

Stars

Watchers

Forks