Search code examples
pythonsearchblogspelican

Enable search function in Pelican-powered blog?


I'm using Pelican and Elegant theme to generate my blog. However, I can't figure out how to turn on the search function. I've added the tipue_search and sitemap plugins, but no luck. I'm attaching the configuration file pelicanconf.py for reference.

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

AUTHOR = u'abc'
SITENAME = u"abc"
DEFAULT_DATE = 'fs'
SITEURL = 'http://example.github.io'
TIMEZONE = 'Asian/Shanghai'
THEME = 'elegant'
DEFAULT_PAGINATION = 10

ARTICLE_URL = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'
ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'
YEAR_ARCHIVE_SAVE_AS = 'posts/{date:%Y}/index.html'
MONTH_ARCHIVE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/index.html'

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

PLUGIN_PATH = 'pelican-plugins'
PLUGINS = ["sitemap", 
       "tipue_search", 
       "render_math", 
       "summary",
       "neighbors"]

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

Solution

  • To use Tipue search there are some more steps to execute after enabling the plugin. Here is a good tutorial.

    Don't forget that you can also use Google Custom Search.