pelican-to-sqlite helps you add powerful search capabilities to your Pelican static site. By converting your Pelican posts into a SQLite database, you can quickly search through all your content using Datasette—without needing a complex backend or search service.
Perfect for bloggers and content creators who want to offer visitors an easy way to search through years of posts.
- Python 3.8 or higher
- An existing Pelican site
- Basic familiarity with command-line tools
uv add pelican-to-sqlite
pip install pelican-to-sqlite
After installing, add the plugin to your Pelican configuration file (pelicanconf.py):
PLUGINS = ['pelican_to_sqlite']Run your Pelican build command to create the SQLite database:
make htmlThis creates a SQLite database called pelican.db in the root of your Pelican site, containing all your post data.
Add a search form to your base.html template (or similar template depending on your theme). Here's an example using Tailwind CSS:
<section class="relative h-8">
<section class="absolute inset-y-0 right-10 w-128">
<form class="pl-4" action="your-action-link-here" method="get">
<label for="site-search">Search the site:</label>
<input type="search" id="site-search" name="text"
aria-label="Search through site content">
<button class="rounded-full w-16 hover:bg-blue-300">Search</button>
</form>
</section>
</section>Replace your-action-link-here with the URL from your deployed Datasette instance (see deployment section below).
You can deploy your SQLite database with Datasette using several methods. Below is a guide for deploying with Vercel.
Note: The
datasette-publish-vercelplugin may have limited maintenance. Consider alternative deployment methods like Datasette Cloud or manual Vercel deployment if you encounter issues.
First, install datasette using uv (or pip)
uv add datasette
# or: pip install datasette
Next, install the datasette plugin datasette-publish-vercel using uv (or pip)
uv add datasette-publish-vercel
# or: pip install datasette-publish-vercel
and the Vercel CLI
Run vercel login to log in to (or create) an account.
Publish your pelican.db to Vercel by running:
datasette publish vercel pelican.dbFor additional publishing options, see the datasette-publish-vercel documentation.
The SQLite database produced by this tool is designed to be browsed using Datasette. For a detailed implementation guide, see the blog post Adding Search to My Pelican Blog with Datasette.
- Issues: Report bugs or request features via GitHub Issues
- Questions: For general questions about usage, please open a GitHub Discussion
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Created by Ryan Cheley