Pelican plugin to add a featured image, extracting from summary or content if not specified in metadata
Project description
Featured Image: A Plugin for Pelican
This Pelican plugin extracts an image from the summary or content of an article or page if not already specified in content metadata.
Installation
This plugin can be installed via:
python -m pip install pelican-featured-image
As long as you have not explicitly added a PLUGINS
setting to your Pelican settings file, then the newly-installed plugin should be automatically detected and enabled. Otherwise, you must add featured_image
to your existing PLUGINS
list. For more information, please see the How to Use Plugins documentation.
Usage
To override the default behavior of selecting the first image in the article's summary or content, set the image property the article's metadata to the URL of the image to display, e.g:
Title: My super title
Date: 2010-12-03 10:20
Category: Python
Tags: pelican, publishing
Slug: my-super-post
Author: Alexis Metaireau
Summary: Short version for index and feeds
Image: /images/my-super-image.png
Article content...
Page
To include a representative image in a page add the following to the template:
{% if page.featured_image %}
<img src="{{ page.featured_image }}">
{% endif %}
Article
To include a representative image in an article add the following to the template:
{% if article.featured_image %}
<img src="{{ article.featured_image }}">
{% endif %}
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 AGPL-3.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pelican_featured_image-1.0.0.tar.gz
.
File metadata
- Download URL: pelican_featured_image-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f19431c76fec9227fc9e7e24f4bd7a49835336270e5bbdaa1c093d6da7f9733 |
|
MD5 | b516d3ae7d7d6d83a247a21f63bb1277 |
|
BLAKE2b-256 | f35a40a422254837482be809fa405f7d76d96db843f06a0550b14fc797902cf4 |
File details
Details for the file pelican_featured_image-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pelican_featured_image-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf57ab6c8edf260b996ad8373ca352c4c9c2df3b7606173123303fa226006a9 |
|
MD5 | daf051eaeca90d8c4cb83947617e12f1 |
|
BLAKE2b-256 | 587cf1f39cffbb3952bdfa3cd1c39e9fe2efc9b7bf8bf6d153243900689b98a0 |