Whichever pelican theme you use you will have to start customising your pelicanconf.py file, and possibly your publishconf.py file.

This is the basic pelicanconf.py file that was created during set-up in the previous post -

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

AUTHOR = u'Sharon'
SITENAME = u'blogo'
SITEURL = ''

PATH = 'content'

TIMEZONE = 'Europe/London'

DEFAULT_LANG = u'en'

# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

# Blogroll
LINKS = (('Pelican', 'http://getpelican.com/'),
         ('Python.org', 'http://python.org/'),
         ('Jinja2', 'http://jinja.pocoo.org/'),
         ('You can modify those links in your config file', '#'),)

# Social widget
SOCIAL = (('You can add links in your config file', '#'),
          ('Another social link', '#'),)

DEFAULT_PAGINATION = 10

# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True

Some things which you might find useful -

  • AUTHOR = u'Sharon' - Change this to your required name.
  • SITENAME = u'blogo' - Change this to what you want your site to be called, and that will appear in the headers of your site.
  • SITEURL = '' - If you leave this as it is it will mean that you can display your site in your chosen browser, whilst you're still developing your site, or updating it.
  • TIMEZONE = 'Europe/London' - Change this to your specific timezone.
  • # Blogroll LINKS = (('Pelican', 'http://getpelican.com/'), - You can add or change any of these to suit your own situation.
  • SOCIAL = (('You can add links in your config file', '#'), - Here's where you can put your email address, twitter account, facebook account, etc.

As you can see its pretty extensible.

Now for the basic publishconf.py file that was created during set-up in the previous post -

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

# This file is only used if you use `make publish` or
# explicitly specify it as your config file.

import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *

SITEURL = 'blogo'
RELATIVE_URLS = False

FEED_ALL_ATOM = 'feeds/all.atom.xml'
CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'

DELETE_OUTPUT_DIRECTORY = True

# Following items are often useful when publishing

#DISQUS_SITENAME = ""
#GOOGLE_ANALYTICS = ""
  • SITEURL = 'blogo' - Obviously you can change this to be your sites name, It must be the same as the previous SITENAME.
  • FEED_ALL_ATOM = 'feeds/all.atom.xml' - This can safely be disabled without any problems.
  • CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml' - Ditto the previous comment.
  • DELETE_OUTPUT_DIRECTORY = True - Do you really want to delete your output directory? And lose all the HTML output which has been generated? You can safely disable this command.
  • #DISQUS_SITENAME = "" - This has been commented out but if you want to use Disqus for managing the comments on your site, then just uncomment it.
  • #GOOGLE_ANALYTICS = "" - Ditto the previous comment except for your google-analytics code.

So now you've seen the basics, lets start changing things to fit your own web-site or blog.

Customisation.

pelicanconf.py

This is the pelicanconf.py file from my development setup, suitably redacted where necessary.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

AUTHOR = u'bananarama'
SITENAME = u'bananarama'
SITEURL = ''

PATH = 'content'
ARTICLE_PATHS = ['posts']

TIMEZONE = 'Europe/London'

DEFAULT_LANG = u'en'

# Specify name of a built-in theme
#THEME = "bootstrap2-dark,gum,new-bootstrap2,bootstrap" 
# Specify name of a theme installed via the pelican-themes tool
THEME = "/home/USER/pelican/themes/elegant2"


PLUGIN_PATHS = ['/home/boudiccas/git/pelican-plugins/']
PLUGINS = ['sitemap','extract_toc','tipue_search','neighbors','assets','related_posts','series']
MD_EXTENSIONS = ['codehilite(css_class=highlight)', 'extra', 'headerid', 'toc']
DIRECT_TEMPLATES = (('index','tags','archives','search','404'))
STATIC_PATHS = ['theme/images','images','downloads']
TAG_SAVE_AS = ''
# CATEGORY_SAVE_AS = '' 
AUTHOR_SAVE_AS = ''
USE_SHORTCUT_ICONS = True

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

# TYPOGRIFY = True
# SITESUBTITLE = ''


# Elegant Labels
SOCIAL_PROFILE_LABEL = u'Whatever you want to say' 
RELATED_POSTS_LABEL = 'Ditto' 
SHARE_POST_INTRO = 'Ditto' 
COMMENTS_INTRO = u'Ditto'

# Feed generation is usually not desired when developing
# FEED_ALL_ATOM = None
# CATEGORY_FEED_ATOM = None
# TRANSLATION_FEED_ATOM = None
# AUTHOR_FEED_ATOM = None
# AUTHOR_FEED_RSS = None

# Blogroll
LINKS = (('Archives', 'archives.html'),
         ('Tags', 'tags.html'),
         ('Links', 'pages/links.html'),
          ('Search', 'search.html'),)
         # ('You can modify those links in your config file', '#'),)

# LINKS = (('Pelican', 'http://getpelican.com/'),
#          ('Python.org', 'http://python.org/'),
#          ('Jinja2', 'http://jinja.pocoo.org/'),
#          ('You can modify those links in your config file', '#'),)

# # Social widget
# SOCIAL = (('You can add links in your config file', '#'),
#           ('Another social link', '#'),)
# Social
SOCIAL = (
        ('Twitter', 'http://twitter.com/bananarama'),
        ('Email', 'mailto:head-banana@bananarama'),
        ('rss', 'http://bananarama/feeds/atom.xml'),
          )


DEFAULT_PAGINATION = 10

# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True

IGNORE_FILES = ['notes.md']
lineums = False
guess_lang = True
  • ARTICLE_PATHS = ['posts'] - If you put this in then you must put all your posts in this folder.
  • .# Specify name of a built-in theme
    #THEME = "bootstrap2-dark,gum,new-bootstrap2,bootstrap"
    # Specify name of a theme installed via the pelican-themes tool
    THEME = "/home/boudiccas/pelican/themes/elegant2" - As you can see I was trying various other themes, until I forked a present one, and made it my own. I'm not going to talk about themes here, that's in the next post.
  • PLUGIN_PATHS = ['/home/boudiccas/git/pelican-plugins/'] - this is to where you've put the git repository of the pelican plugins.
  • PLUGINS = ['sitemap','extract_toc','tipue_search','neighbors','assets','related_posts','series'] - here is the names of all the plugins that I've used. They must be seperated as I've shown.
  • MD_EXTENSIONS = ['codehilite(css_class=highlight)', 'extra', 'headerid', 'toc'] - this is only relevant if you're going to use markdown for writing your posts with.
  • DIRECT_TEMPLATES = (('index','tags','archives','search','404')) - this is theme specific, on some themes you might not have anything here, on others you may have more templates being used.
  • STATIC_PATHS = ['theme/images','images','downloads'] - this tells pelican where any images that you've used are, and ditto downloads too.
  • # CATEGORY_SAVE_AS = '' - I've commented this out as I don't want to use categories, I find that tags are much better and I prefer them.
  • # TYPOGRIFY = True - If set to True, several typographical improvements will be incorporated into the generated HTML via the Typogrify library.
  • # SITESUBTITLE = '' - If you enter something here then it may appear on your site, but it depends if your chosen theme supports it.
  • DEFAULT_PAGINATION = 10 - This is where you can identify how many posts appear on your index page.
  • IGNORE_FILES = ['notes.md'] - You can put any file name here which will not be processed into HTML, I just use it to remind me of various markdown things.
  • lineums = False - This is supposedly where you can get line numbers to work for code excerpts, but I've never got it to work.


Comments

comments powered by Disqus