Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 2.36 KB

pelican-tips.md

File metadata and controls

77 lines (53 loc) · 2.36 KB

Pelican Tips

Bootstrap Classes

To have Bootstrap classes set for rendered html (.table, .img-fluid etc), use the Bootstrapify Pelican plugin.

In your Pelican site:

mkdir plugins
git submodule add https://github.com/ingwinlu/pelican-bootstrapify plugins/pelican-bootstrapify

And in Pelican config:

# http://docs.getpelican.com/en/stable/plugins.html#how-to-use-plugins
PLUGIN_PATHS = ['plugins']
PLUGINS = ['pelican-bootstrapify']

BOOTSTRAPIFY = {
    'table': ['table', 'table-striped', 'table-hover'],
    'img': ['img-fluid'],
    'blockquote': ['blockquote'],
}

Use BOOTSTRAPIFY to pass a {'css-selector': ['list-of-classes']} dict to the plugin. Bootstrapify will append list-of-classes to all tags that match css-selector.

Favicons

To use the RFG_FAVICONS setting, visit Favicon Generator to generate a favicon package and download it.

In your Pelican site:

mkdir content/extras
unzip <PATH_TO_PACKAGE>.zip -d content/extras

And in Pelican config:

# https://github.com/getpelican/pelican/wiki/Tips-n-Tricks#second-solution-using-static_paths
STATIC_PATHS = ['extras', 'images']
EXTRA_PATH_METADATA = {
    'extras/android-chrome-192x192.png': {'path': 'android-chrome-192x192.png'},
    'extras/apple-touch-icon.png': {'path': 'apple-touch-icon.png'},
    'extras/browserconfig.xml': {'path': 'browserconfig.xml'},
    ...
}

RFG_FAVICONS = True

EXTRA_PATH_METADATA should correspond with the favicon package:

unzip -l <PATH_TO_PACKAGE>.zip

Link posts

When adding a Link: field to the post's metadata header, the article will be rendered as a link post, which means a link icon will appear behind its title, and the title of the article will link to the destination of the link when viewing the article page. In that same page a 'view link' link/button will be rendered at the end of the content.

Use sitemap.xml

There is a sitemap.html Jinja2 template that can be used to generate a sitemap.

In your Pelican config:

# Default value is ['index', 'tags', 'categories', 'authors', 'archives']
DIRECT_TEMPLATES = ['index', 'tags', 'categories', 'authors', 'archives', 'sitemap']
SITEMAP_SAVE_AS = 'sitemap.xml'