Skip to main content

Pelican plugin to generate OpenGraph images

Project description

Generate OpenGraph images for Pelican

PyPI Version Downloads License

This plugin generate OpenGraph images for each page of your Pelican website. It can be used with the SEO plugin for the OpenGraph meta tags generation.

Installation

This plugin can be installed via:

pip install pelican-ogimages

If not done automatically, add pelican.plugins.ogimages to your existing PLUGINS list.

Pay attention it must before SEO plugin in the list.

Usage

Once installed, the plugin generate a simple image for all the pages and articles. You can override some configuration in your Pelican settings:

OGIMAGES_BACKGROUND_IMAGE = None
OGIMAGES_BACKGROUND_COLOR = "#F5F4EF"

OGIMAGES_SITENAME = True
OGIMAGES_SITENAME_COLOR = "#C74350"
OGIMAGES_SITENAME_POSITION = (100, 100)

OGIMAGES_TITLE_COLOR = "#C74350"
OGIMAGES_TITLE_POSITION = (100, 300)

OGIMAGES_SIZE = (1200, 600)

Advanced customization

For advanced customization, you can override the generation function and set it to OGIMAGES_GENERATOR.

Exemple in the pelicanconf.py:

from PIL import Image, ImageDraw

def generate_og_image(output_path, title, content):
    img = Image.open("og_image_template.png")
    d = ImageDraw.Draw(img)
    d.text((100, 200), title, fill="#5d1c6a", anchor="ls", font_size=60)
    img.save(output_path, "PNG", optimize=True)

OGIMAGES_GENERATOR = generate_og_image

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.

AI Policy

This project does not allow contributions generated or assisted by Large Languages Models (LLM) or chatbots. This concerns all parts of the project, including, but not limited to, code, documentation, issues and artworks.

License

This project is licensed under the AGPL-3.0 license.

Credits

The project is carried out by the SPIRKOP cooperative 🇪🇺.

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_ogimages-0.1.1.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

pelican_ogimages-0.1.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file pelican_ogimages-0.1.1.tar.gz.

File metadata

  • Download URL: pelican_ogimages-0.1.1.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.0 CPython/3.13.5 Linux/6.12.90+deb13.1-amd64

File hashes

Hashes for pelican_ogimages-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6d872e2dd6290f34c3c3e357c1c8406b3ee4ce09cc4f830d4e1dfd37af9943ad
MD5 ad8a78576795d50632dd34b2276bb509
BLAKE2b-256 682d614b75df2f2139df4f800ed6988f138dc7c4dc9163306c7cb656ecb14a66

See more details on using hashes here.

File details

Details for the file pelican_ogimages-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pelican_ogimages-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.0 CPython/3.13.5 Linux/6.12.90+deb13.1-amd64

File hashes

Hashes for pelican_ogimages-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e02d802cb5f4df16e262d0c14b6bc0e5d739926b01fbb3f5008c8aab79148375
MD5 c54f14b6be827e4f5a1b55f46309405a
BLAKE2b-256 7a8bc5863af6370ff786884f661b2a8100c7c98ca0f419fa0215c603e0d18671

See more details on using hashes here.

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