----- Date:

Unicorn Hork

Unicorn Hork

Get it from github

The pelican theme used on this site has a number of features I wanted but didn't see in the pelican-themes repo. With gratitude to all those whose examples helped me realize my vision, I'm publishing my theme to stand beside theirs for the use and inspiration of others.

Unicorn magic #

  • LIGHT weight and NO JavaSkirpt 1
  • soothing, easy to read, 'Neon Dark' theme colors
  • Uses CSS Flexbox for overall layout
  • Left, Right, Top and Bottom "aside" layout areas provided for use
  • Optional Taglines and Images on Posts
  • 'Category Pages' offer 'pinned post' functionality as well as easily-edited 'page top' information on categories.
  • Twitter/Facebook/SEO metadata entries with graceful fallbacks between per-post and site-wide descriptions where appropriate.
  • navigational elements can be turned off or relocated easily
  • includes the usual support for code highlighting via Pygments and support for Feeds, Google Analytics, and Disqus comments.
  • degrades gracefully to smaller devices and older browsers
  • Looks like crap on Internet Exploder 11

Config File #

Several theme features are controlled by configuration file variables (in pelicanconf.py, see provided example). In addition to those supported by other themes (AVATAR, SOCIAL, etc) we have:

  • DISPLAY_TAGS_ON_MENU - Bool controlling the 'Tags' box in the sidebar

  • HIDE_INDEX_CATEGORIES - List of categories not to display in the sidebar

  • CATEGORY_PAGE_HEADS - Bool, if True Category indexes place any pages of their category at the top of the list of articles. A page being used this way will, if its summary tag is 'FULL' and nothing else, be used as 'top text' for the category.

    • The word 'nocategory' in the snafu: header on a page will suppress this if you need to.
  • HIDE_MAIN_AUTHOR - Bool, if True, author information will not be displayed unless it is != AUTHOR

  • NAVHEAD_LINKS - bool, when true the titles of the sidebar boxes 'Categories' and 'Tags' are also links to those pages.

  • AUTHOR_URL - string, URL to link the AUTHOR title on the SOCIAL list.

  • SIDEBAR_DIGEST - string, text to put below the site name and AVATAR in the sidebar

  • AD_IMG and AD_URL - strings, image and link URLs for a 160x600 banner ad I use.

  • MENUITEMS - List of ('name','url') tuples. Top menu in the sidebar. Has special style in CSS.

  • MENU_FOOT - see MENUITEMS. Example config is a debug menu I use, comment out the line MENU_FOOT = () to activate it in testing.

Custom headers #

postimg: if found, is used in the article lists and article render. it should be 200px wide. the header contents are a filename reference to the pic; ie postimg: /art/somepic.png. This is not processed through the normal pelican references, no {static} etc.

Tagline: is a md interpreted 2 text slug. It will appear under head and title elements in the rendered HTML. Left blank or the string none result in no tagline elements being included. This may be used in pages or posts, and is not required.

sponsor: in posts makes the post_header_paid style apply to the header, adds a 'Sponsored by' box at the top of the post int he rendered HTML, and links the sponsor with the sponsor_link: header.

Both pages and posts can have a snafu: header, which contains flags for some theme features.

  • noaside suppresses a page from being displayed on the sidebar. (if DISPLAY_PAGES_ON_MENU is True)

  • nocategory keeps a page from being displayed at the top of its Category as a sticky post. (when CATEGORY_PAGE_HEADS = True in config)

  • paid causes the post to have a different class applied to the header. post_header_paid vs. post_header.

Template files #

side_one.html and side_two.html are the left and right sidebars. Currently the right side is commented in the template file (look for the {# #} block in base.html).

Any or all of the navigational element blocks, the 'Categories' box, Avatar image and so on, should swap between either sidebar smoothly. Disabling any block can be done with config file variables.

article_head.html is used to build the index page entries as well as the tops of article pages.

article_list.html is used in the top, category, and tags indexes.

The article_table.html template is used for various archive pages and other views I don't use. Sorry about that.

Example config values #

# ########################################
#
# Theme Options
#
# ########################################

DISPLAY_CATEGORIES_ON_MENU = True
DISPLAY_PAGES_ON_MENU = True
DISPLAY_TAGS_ON_MENU = True

# categories not listed in sidebar
HIDE_INDEX_CATEGORIES = ['for sale','etc']

# do pages of category on top of category indexes
CATEGORY_PAGE_HEADS = True

# True to only have "author" info/links for others in post headers
HIDE_MAIN_AUTHOR = True

# headers in navbar elements become links? (categories.html, tags.html)
NAVHEAD_LINKS = True

# where the SOCIAL title / AUTHOR link points
AUTHOR_URL = 'pages/h2odragon.html'

# text on sidebar
SIDEBAR_DIGEST ='Rantings of a Redneck Techno-barbarian'

# pic on sidebar /  'shortcut icon' in meta
AVATAR = 'static/images/unicorn2-160.png'

# AD img / link
AD_IMG = 'static/images/unicorn2-160.png'
AD_URL = '#'

# top menu
MENUITEMS = (
    ('FOR SALE',  '/category/for-sale.html'),
    )

# Social wingnut
SOCIAL = (
    ('github', 'https://github.com/h2odragon'),
    ('discord', 'https://discord.gg/ejfqYCC'),
)

# bottom menu; this is debugging define then redefine
MENU_FOOT = (
    ('Archives',  '/archives.html'),
    ('Tags',  '/tags.html'),
    ('Authors',  '/authors.html'),
    ('Categories',  '/categories.html'),
    )
MENU_FOOT = () 


# many themes support these, so does this, all hail copy and paste
GOOGLE_ANALYTICS = ''
DISQUS_SITENAME = ''

  1. well actually the GOOGLE_ANALYTICS and DISQUS_SITENAME things involve a little bit of JS, but I just copied and pasted that and I don't use it so I feel innocent, still. 

  2. include it in FORMATTED_FIELDS in pelicanconf.py