Skip to content

Instantly share code, notes, and snippets.

@GMadorell
Created March 28, 2014 23:46
Show Gist options
  • Select an option

  • Save GMadorell/9845354 to your computer and use it in GitHub Desktop.

Select an option

Save GMadorell/9845354 to your computer and use it in GitHub Desktop.
Pelican steps

##Installing pelican Remeber to use a virtual env ;).

pip install pelican  
pip install Markdown  
pip install Fabric
pip install beautifulsoup4

Adding the plugins and themes repos.

git clone https://github.com/getpelican/pelican-plugins.git plugins
git clone --recursive https://github.com/getpelican/pelican-themes themes

##Initial steps http://pelican.readthedocs.org/en/3.3.0/getting_started.html
pelican-quickstart -> builds a skeleton project

yourproject/
├── content
│   └── (pages)
├── output
├── develop_server.sh
├── fabfile.py
├── Makefile
├── pelicanconf.py       # Main settings file
└── publishconf.py       # Settings to use when ready to publish
  • Generate site: fab build
  • Automatically regenerate site every time a change is detected: fab regenerate.
  • Serve for browser preview (localhost:8000): fab serve.
  • If during quikcstart selected yes to ssh publish: fab publish.

##What to gitignore?

  • themes folder.
  • plugins folder.
  • output folder.

##Articles Create them inside contents (under whatever folder structure you want, it just works).
Needed metadata:

Title: My super page
Date: 2010-12-03 10:20
Category: Python
Tags: pelican, publishing
Slug: my-super-post
Author: Gerard Madorell
Summary: Short version for index and feeds

##Pages Creating a folder names 'pages' inside content will make them appear.
Create md documents inside of 'pages' folder.

##Plugins Below is a description of non-standard plugins (not included in the plugins repos).

###Ipython ####Install cd plugins
git clone https://github.com/danielfrg/pelican-ipythonnb
mv pelican-ipythonnb ipythonnb

####Usage

  • Place ipython notebook file in some place inside contents (.ipynb)
  • Create a file with same name as notebook with extension .ipynb-meta.
  • Inside the meta file, add usual metadata (same as an article, with the same format) WITH A BLANK LINE AT THE END.

##Settings List of things changed from the default parameters (after quickstart):

  • Add PATH = './content'. This way it takes the content folder as the one to build.
  • PLUGIN_PATH = './plugins'
  • Add custom plugins: PLUGINS = ['ipythonnb']
  • MARKUP = ('md', 'ipynb') # Enable ipython articles.
  • Deleted blogroll: LINKS = None
  • Changed SOCIAL to include social networks info.

##Publishing http://pelican.readthedocs.org/en/3.3.0/tips.html#publishing-to-github

$ fab rebuild
$ ghp-import output
$ git push origin gh-pages

Your page should be avaiable under www.username.github.com/blogname in ~10 mins.

Elegant theme.

If doubting: check the main page built with this theme @ https://github.com/talha131/onCrashReboot or the documentation @ http://oncrashreboot.com/elegant-best-pelican-theme-features

Settings

Add this to the configuration (pelicanconf).

PLUGINS += ['sitemap', 'extract_toc', 'tipue_search']
MD_EXTENSIONS = ['codehilite(css_class=highlight)', 'extra', 'headerid', 'toc']
DIRECT_TEMPLATES = (('index', 'tags', 'categories','archives', 'search', '404'))
STATIC_PATHS = ['theme/images', 'images']
TAG_SAVE_AS = ''
CATEGORY_SAVE_AS = ''
AUTHOR_SAVE_AS = ''

Following is a list of optional parameters:

RECENT_ARTICLES_COUNT (integer)  
COMMENTS_INTRO ('string')
SITE_LICENSE ('string')
SITE_DESCRIPTION ('string')
EMAIL_SUBSCRIPTION_LABEL ('string')
EMAIL_FIELD_PLACEHOLDER ('string')
SUBSCRIBE_BUTTON_TITLE ('string')
MAILCHIMP_FORM_ACTION ('string')
SITESUBTITLE ('string')
LANDING_PAGE_ABOUT ({})
PROJECTS ([{},...])

Optional article meta data

subtitle
summary
disqus_identifier
modified
keywords

##Code highlight

A block of text

    :::identifier (such as python)
    <some code>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment