Skip to main content

Pelican plugin to surface articles published on the same month/day in previous years.

Project description

pelican-on-this-day

Pelican plugin that shows articles published on the same month/day in previous years — an "On This Day" section.

The section is rendered client-side: at build time the plugin writes a JSON map of "MM-DD" → articles to the output, and the bundled JS picks the visitor's local date at page load. The section therefore stays correct on a static host without daily rebuilds, and articles from the visitor's current year are excluded.

Usage

Add to PLUGINS in pelicanconf.py:

PLUGINS = [
    ...
    "pelican.plugins.on_this_day",
]

That's it for the Attila theme (needs the version providing the partials/footer_extra.html hook) — the plugin overrides that hook with a placeholder and wires everything up:

<aside id="on-this-day" hidden data-source="{{ SITEURL }}/static/pelican_on_this_day/on-this-day.json">
  <div class="inner">
    <p class="on-this-day-label">{% trans %}On This Day{% endtrans %}</p>
    <div class="on-this-day-grid"></div>
  </div>
</aside>
<script src="{{ SITEURL }}/static/pelican_on_this_day/js/on-this-day.js" defer></script>

For other themes

The plugin only needs the placeholder <aside> and the script tag somewhere in your templates — no Attila-specific markup or CSS variables required:

<aside id="on-this-day" hidden data-source="{{ SITEURL }}/static/pelican_on_this_day/on-this-day.json">
  <p class="on-this-day-label">On This Day</p>
  <div class="on-this-day-grid"></div>
</aside>
<script src="{{ SITEURL }}/static/pelican_on_this_day/js/on-this-day.js" defer></script>

The JS fills .on-this-day-grid with <a class="on-this-day-item"> entries and removes hidden when there are matching articles. The section stays hidden when there is nothing to show (or when the data file can't be fetched). The bundled CSS (added to CSS_OVERRIDE automatically) styles those classes using --color-background-contrast, --color-content-secondary, and --color-primary custom properties — define them yourself, or skip the bundled CSS (drop on-this-day.css from CSS_OVERRIDE after the plugin adds it) and style .on-this-day-item and friends to match your theme.

Settings

  • ON_THIS_DAY_MAX_ITEMS (optional, default unlimited) — cap the number of articles shown per day, keeping the newest ones.

What gets emitted

  • output/static/pelican_on_this_day/on-this-day.json{"MM-DD": [{"year", "date", "title", "url"}, ...], ...}, newest first, URLs prefixed with SITEURL
  • output/static/pelican_on_this_day/js/on-this-day.js — client-side renderer
  • output/static/pelican_on_this_day/css/on-this-day.css — appended to CSS_OVERRIDE automatically

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_on_this_day-0.5.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pelican_on_this_day-0.5.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pelican_on_this_day-0.5.0.tar.gz.

File metadata

  • Download URL: pelican_on_this_day-0.5.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pelican_on_this_day-0.5.0.tar.gz
Algorithm Hash digest
SHA256 52fffb61497781e76a727dffd49fc02fa0d930ecd173a97d3781e2fb83344b53
MD5 4f8963c33d260edd7afd269c0823c037
BLAKE2b-256 eab251795ae3f2bd0ff862c10dc4723477a6390d6352a89f50b13bc5f521ea87

See more details on using hashes here.

Provenance

The following attestation bundles were made for pelican_on_this_day-0.5.0.tar.gz:

Publisher: publish-to-pypi.yaml on Lee-W/pelican-on-this-day

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pelican_on_this_day-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pelican_on_this_day-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49941d4b1567d17bfeb265c6c98699f805ef088724320b11134d0de7c55dd84a
MD5 05f21b47268c4affa7a9dedb937c7d4f
BLAKE2b-256 e8e37e4410efedcf2fb6cdc90ceb3197ba3957e6b22de88c783ebe8b348e05f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pelican_on_this_day-0.5.0-py3-none-any.whl:

Publisher: publish-to-pypi.yaml on Lee-W/pelican-on-this-day

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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