Skip to main content

A Pelican Plugin for outputting your Pelican posts into a SQLite Database

Project description

pelican-to-sqlite

PyPI GitHub changelog Tests License pre-commit.ci status

Create a SQLite database containing data posts from your local pelican files.

How to install

pip install pelican-to-sqlite

Usage

Once the plugin has been installed you only need to run make html to create a SQLite database called pelican.db which will be created in the root of your pelican site.

You will need to add a form to your base.html template (or similar template depending on your theme). The form that needs to be added looks like this (assuming you use Tailwind):

<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>

In the above, your-action-link-here should be substituted for the link that you get from your Vercel hosted instance of datasette.

Deploy using Vercel

There are many options to deploy your SQLite database with datasette. Below describes using Vercel.

First, install datasette using pip

pip install datasette

Next, install the datasette plugin datasette-publish-vercel using pip

pip install datasette-publish-vercel

and the Vercel CLI

Once that's done, run vercel login to login to (or create) an account.

To publish your pelican.db to Vercel just run:

datasette publish vercel my-database.db

There are several options for outputting to Vercel. See the documentation for more details

Using with Datasette

The SQLite database produced by this tool is designed to be browsed using Datasette. See my post Adding Search to My Pelican Blog with Datasette for more details on how I implemented it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican-to-sqlite-0.6.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

pelican_to_sqlite-0.6.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file pelican-to-sqlite-0.6.0.tar.gz.

File metadata

  • Download URL: pelican-to-sqlite-0.6.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for pelican-to-sqlite-0.6.0.tar.gz
Algorithm Hash digest
SHA256 396e09b202b703a86e93d6446999f9ddbc00d92ecac071509e5f076025e9b9d0
MD5 f3430f97d17de7a0810d3fd448fcf249
BLAKE2b-256 5f47261b67c64a4e8242729f6d5bcf3ab6098a518b137b47dd990c5dcc42ce75

See more details on using hashes here.

File details

Details for the file pelican_to_sqlite-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pelican_to_sqlite-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ab3dd1da062ef80de887fbd17cfec87aa22747185b4c306dea7b55afd35b314
MD5 5d2455ddce4c0a1782dfac133cc180d6
BLAKE2b-256 96dc39d33c907016665cecc6ace6c20742f87ae0b81a7f059c08017ae01edf93

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page