spiroid / pelican-hpstr

Port of jekyll-hpstr-theme to pelican
GNU General Public License v2.0
4 stars 3 forks source link

HPSTR Pelican Theme

This is a port of the HPSTR Theme to the Pelican static site generator.

All credits for the initial Jekyll theme go to Michael Rose

What HPSTR brings to the table:

Supported plugins

Pelican blogging system comes with additional plugins that you can install and activate for your website. For more information see the pelican-plugins repository.

Here are the plugins that should work out of the box with that theme if enabled:

Localization | Translation

This theme has some items / texts marked as localized in templates files. It relies on the [Jinja2 i18n extension] (http://jinja.pocoo.org/docs/templates/#i18n) to do the job and replace these texts with their translated couterparts in the appropriate language.

It means that you need to enable the jinja2.ext.i18n extension by adding the following line to your pelican configuration :

JINJA_EXTENSIONS = ['jinja2.ext.i18n']

THIS IS MANDATORY, please don't skip this step otherwise you won't be able to generate the website.

Add translations for a language

You downloaded this theme and love it but unfortunately your favorite language is not supported ? -> We need you !

  1. Please follow these instructions for how to translate template items
  2. Make a pull request
  3. Receive many thanks from the community :)

Content license

You can optionally declare a Creative Commons license for the content of your site. It will appear in the site's footer. To enable, use one of the following two ways for configuration.

The license choice mirrors the Creative Commons License Chooser. Source for the macro that renders the mark is at http://github.com/hlapp/cc-tools.

Footer

The footer will display a copyright message using the AUTHOR variable and the year of the latest post. If a content license mark is enabled (see above), that will be shown as well.

Setup for an existing pelican website

  1. Clone this theme into your pelican's site theme directory
  2. Update your site pelicanconf.py configuration file
#!/usr/bin/env python
# -*- coding: utf-8 -*- #

from __future__ import unicode_literals

# Required as some texts in this theme templates are localized with gettext
JINJA_EXTENSIONS = ['jinja2.ext.i18n']

# User info
AUTHOR = u'Your name'
AUTHOR_ABOUT = u'Your bio goes here. It shouldn't be super long but a good two sentences or two should suffice.'

SITENAME = u'Site Title'
SITEURL = ''

# Directories configuration
PATH = 'content'
ARTICLE_PATHS = ['posts']

# Any extra files should be added here
STATIC_PATHS = [
    'extra',
    'images'
]

EXTRA_PATH_METADATA = {
    'extra/robots.txt': {'path': 'robots.txt'}
}

# By default we enable pretty highlighing in markdown:
MD_EXTENSIONS = ['codehilite(css_class=highlight)', 'extra', 'toc']

# Pagination
DEFAULT_PAGINATION = 3

# Categories
USE_FOLDER_AS_CATEGORY = False
DEFAULT_CATEGORY = 'Misc'

# Plugin path
PLUGIN_PATHS = ['../pelican-plugins']
PLUGINS = ['related_posts', 'sitemap', 'i18n_subsites']

# Theme
THEME = 'theme/pelican-hpstr'

# Theme options
BACKGROUND = 'bg_image.png'
ABOUT_PAGE = 'about.html'

# Social widgets
SOCIAL = (('github', 'https://github.com/yourname', 'GitHub'),
          ('twitter', 'http://twitter.com/yourname'),
          ('linkedin', 'http://fr.linkedin.com/in/yourname', 'LinkedIn'),)

# Social meta tags info
SOCIAL_META_ENABLED = True
SOCIAL_META = {
    'google': '<GOOGLE_ID>',
    'twitter': {
        'creator': '@creator_id'
        'site': '@site_id'
    }
}

# Sitemap configuration
SITEMAP = {
    'format': 'xml',
    'priorities': {
        'articles': 0.5,
        'indexes': 0.5,
        'pages': 0.5
    },
    'changefreqs': {
        'articles': 'weekly',
        'indexes': 'daily',
        'pages': 'monthly'
    }
}

# I18n
I18N_TEMPLATES_LANG = 'en'
  1. Deployement specific configuration publishconf.py
#!/usr/bin/env python
# -*- coding: utf-8 -*- #

# Enable google analytics
GOOGLE_ANALYTICS = "YOUR TRACKING ID"

Questions / Requests ?

Having a problem getting something to work, have some questions or want an addition to this theme ? Ping me on Twitter @jonathan_dray or file a GitHub Issue.

License

As the original theme is licensed under the GNU General Public License, i choose to distribute the Pelican version under the same conditions. This theme is free and open source software, distributed under the GNU General Public License version 2 or later. So feel free to to modify this theme to suit your needs.