A friendly Pelican theme - Live Demo here!
$ git clone https://github.com/dokelung/jojo.git
$ cd jojo/examples
$ git clone https://github.com/getpelican/pelican-plugins.git
$ cd pelican-plugins
$ git clone https://github.com/burakkose/just_table.git
$ cd ..
$ pelican content -o output -s exconf.py
$ cd output
$ python -m pelican.server
open your browser and goto http://localhost:8000, that's all!
- uikit2 based theme (have nice look and easy to modify)
- embedded site search engine tipue_search
- better chinese article look, guided by 十項讓長文章更容易閱讀的原則
- disqus comment system support
- google analytics google analytics support
Followings are my dev environments:
- python: 3.6.0
- pip: 9.0.1
- pelican: 3.7.1
- beautifulsoup4: 4.5.3
- uikit2
Require pelican plugins:
- tipue_search: need beautifulsoup4
- just_table
- representative_image: need beautifulsoup4
Open pelicanconf.py
to modify your settings:
See examples:
AUTHOR = 'jojo'
SITENAME = 'jojo'
SITEURL = 'http://localhost:8000'
DEFAULT_PAGINATION = 10
To fully enable all features of jojo, please specify DIRECT_TEMPLATES
as followings:
DIRECT_TEMPLATES = ('index', 'categories', 'tags', 'archives', 'search')
Actually, you don't have to fully follow the settings below, but I recommand you to follow them:
# content path
PATH = 'content'
# specify plugins
PLUGIN_PATHS = ['pelican-plugins']
PLUGINS = ['tipue_search', 'just_table', "representative_image"]
# just table settings
JTABLE_TEMPLATE = """
<table class="uk-table uk-table-striped">
{% if caption %}
<caption> {{ caption }} </caption>
{% endif %}
{% if th != 0 %}
<thead>
<tr>
{% if ai == 1 %}
<th> No. </th>
{% endif %}
{% for head in heads %}
<th>{{ head }}</th>
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for body in bodies %}
<tr>
{% if ai == 1 %}
<td> {{ loop.index }} </td>
{% endif %}
{% for entry in body %}
<td>{{ entry }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
"""
# static
STATIC_PATHS = ['images', 'articles']
# articles
ARTICLE_PATHS = ['articles']
ARTICLE_URL = 'category/{category}/{slug}/'
ARTICLE_SAVE_AS = 'category/{category}/{slug}/index.html'
# pages
PAGE_URL = 'pages/{slug}/'
PAGE_SAVE_AS = 'pages/{slug}/index.html'
THEME = 'path/to/jojo' # specify your own path to jojo
Open pelicanconf.py
to modify your settings and remember to put all photos under content/images
and just specify their base names in following settings:
SHORTCUT_ICON = 'jojo.jpg'
jojo lets user set serveral panels in the right column, including:
- a page view panel (set by
PAGEVIEW_URL
) - an author panel (set by
AUTHOR_INFO
) - a newest articles panel (set by
NEWEST_ARTICLES
) - several user defined simple panel (set by
SIMPLE_PANELS
) - a related links panel (set by
RELATED_LINKS
)
# PAGEVIEW_URL = "your pageview image url fetched by http://www.free-counter.jp/"
PAGEVIEW_URL
is a url string fetched by hit counter service http://www.free-counter.jp/
SOCIAL = {
'style': {
'size': 'medium', # small, medium, large
'hover': True, # True, False
'button': False, # True, False
},
# for SOCIAL, jojo supports uk-icon in uikit2
# but jojo only recover following icons' color
'icons': (
('envelope-square', '#'),
('facebook-square', '#'),
('github-square', '#'),
('google-plus-square', '#'),
# ('linkedin-square', '#'),
# ('skype', '#'),
# ('twitter-square', '#'),
# ('weixin', '#'),
)
}
AUTHOR_INFO = {
'id': AUTHOR,
'photo': 'jojo.jpg',
'intro_keywords': (
('a cute dog', '#'),
('a charming blogger', '#'),
),
'intro': [
'Hi, my name is jojo, I am a cute dog!',
'你好,我是 jojo,一隻可愛的小狗。'
],
'url': os.path.join(SITEURL, 'pages', 'about-me'),
'social': SOCIAL,
}
SOCIAL
is a variable used inAUTHOR
to specify your social network:style
: modify it to adjust the appearence of social iconsicons
: specify the social icons you want with format(ICON_NAME, URL)
AUTHOR_INFO
id
: usually equal toAUTHOR
photo
: photo of author (place this image undercontent/images
)intro_keywords
: tuple of tuples, each item represents a hyper link specified by format(TEXT, URL)
intro
: list of strings to describe authorurl
: the url of about-me pagesocial
: dictionary used to specify social networks
NEWEST_ARTICLES = 10 # set 0 to hide this panel
NEWEST_ARTICLES
: an integer to specify the number of newest articles listed in newest articles panel.
SIMPLE_PANELS = (
{
'badge': {
'string': 'Love',
# type can be specified as '' or 'success' or 'warning' or 'danger'
# by default, '' is blue, 'success' is green, 'warning' is orange and 'danger' is red
# please reference to uikit2
'type': 'danger',
},
'title': 'My Favorite Food',
'photo': 'food.jpg',
'content': 'I really love it!',
'link': ('Where to eat it?', '#'),
},
)
SIMPLE_PANELS
: a variable to set user specified simple panelbadge
: a dictionarystring
: panel badge nametype
: used to specify badge color
title
: panel namephoto
: pnael photocontent
: string to describe panellink
: a tuple with format(LINK_TITLE, URL)
jojo supports a related links with Accordion effect:
RELATED_LINKS = (
('Pelican', 'http://getpelican.com/'),
('Python.org', 'http://python.org/'),
('Jinja2', 'http://jinja.pocoo.org/'),
('mg', 'https://github.com/lucachr/pelican-mg'),
)
RELATED_LINKS
: tuple of tuples, each element specify a related link with format(LINK_NAME, URL)
jojo supports button tools in the left side column, including:
- a series of buttons to share your page to social networks (set by
SHARE_BUTTONS
) - a series of buttons for going to previous/next page and/or to top/bottom of the current page
SHARE_BUTTONS = True
CONTROL_BUTTONS = True
SHARE_BUTTONS
: a boolean valueCONTROL_BUTTONS
: a boolean value
jojo has a top navigator and a related links panel
NAV = {
'sitename': SITENAME,
'navitems': (
{
'primary': ('About me', AUTHOR_INFO['url']),
},
{
'primary': ('Category', os.path.join(SITEURL, 'categories.html')),
'secondary': (
{'type':'header', 'name':'Programming'},
{'link':('python', os.path.join(SITEURL, 'category', 'python.html')) },
{'type':'divider'},
{'link':('misc', os.path.join(SITEURL, 'category', 'misc.html'))},
)
},
{
'primary': ('Archives', os.path.join(SITEURL, 'archives.html')),
},
),
'tipue_search': True,
}
sitename
: the logo name of the sitenavitems
: tuple of dictionaries, each element represents a menu item of navigatorprimary
: first class menu item with format(ITEM_NAME, URL)
secondary
: the items of submenu, tuple of dictionariestipue_search
: a bool value, setTrue
to turn on site search engine
LOCATION = True
LOCATION
: a bool value, setTrue
to enable location bar
FOOTER = {
'year': 2017,
'author': AUTHOR,
'license': {
'name': 'The MIT License',
'link': 'https://opensource.org/licenses/MIT',
}
}
# DISQUS_SITENAME = "your disqus shortname"
# DISQUS_CONFIG = True
DISQUS_SITENAME
: specify your disqus shortname here to enable disqus comments systemDISQUS_CONFIG
: setTrue
to set disqus page identifier and page url for disqus to find thread and load content
# GOOGLE_ANALYTICS = "your google analytics number"
GOOGLE_ANALYTICS
: specify google analytics number of your site here