Skip to main content

Redirect pages using meta http-equiv tags

Project description

Pelican Redirect: A Plugin for Pelican

build PyPI Version Python Versions License

Redirect pages using meta http-equiv tags

Installation

This plugin can be installed via:

python -m pip install pelican-redirect

After the plugin is installed via pip, add pelican_redirect to your PLUGINS list in pelicanconf.py

PLUGINS = ['pelican_redirect', ...]

Usage

Once this plugin is installed, you can add a key to the frontmatter of the file called original_url. The plugin will generate an HTML page at that location that redirects to the new location of the post/page. Example:

Title: A sample title
original_url: blog-posts/2021/07/21/a-sample-title.html

Content here

Assuming this file is now going to be served from blog-posts/a-simple-title.html, a file will be written to blog-posts/2021/07/21/a-sample-title.html that redirects to the new URL.

If original_url does not have a file extension, or the file extension is something other than .htm or .html, then original_url is assumed to be a directory and index.html is appended to the URL.

Bulk Usage

To perform a page-wide redirect, you can use the CONTENT_REDIRECT_CONFIGURATION setting, which allows you to configure an original URL using page metadata. The structure of this configuration key looks like so:

CONTENT_REDIRECT_CONFIGURATION = [
    {
        "ARTICLE_URL": "old/layout/{slug}.html",
        "PAGE_URL": "old/pages/{slug}.html",
    }
]

For any entry in that list, if there is no key for the content type (for example, one configuration may only have ARTICLE_URL, another might only have PAGE_URL), the redirect will only be generated for the keys that are specified and the others will be skipped.

Contributing

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.

To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.

License

This project is licensed under the BSD-3-Clause license.

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_redirect-3.0.0.tar.gz (47.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_redirect-3.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pelican_redirect-3.0.0.tar.gz.

File metadata

  • Download URL: pelican_redirect-3.0.0.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pelican_redirect-3.0.0.tar.gz
Algorithm Hash digest
SHA256 44fdb03922c487be2fa776b0fb608c003ba012464e4a3dcd46baaeecd74a80d0
MD5 2b936a606a5759fa1ef6cf1a52c75b5b
BLAKE2b-256 dd0b5e1847898f934728b010dc1a991102af3f8882b89d8993934146d903d0ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pelican_redirect-3.0.0.tar.gz:

Publisher: release.yml on bryanwweber/pelican-redirect

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_redirect-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pelican_redirect-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f70b99cbf315c24f77d642cfa8ae9bb47e4dbc822e660e3d170de2ca1a1f3ebf
MD5 471da9ddaebf8df6feb907cc3573772c
BLAKE2b-256 21660914c2d8590f51841e576c5ca82e7ee4a4e0ddc5d5e6b4e0d36bf8575343

See more details on using hashes here.

Provenance

The following attestation bundles were made for pelican_redirect-3.0.0-py3-none-any.whl:

Publisher: release.yml on bryanwweber/pelican-redirect

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