Skip to content
Pilosus Open Graph Pelican Plugin
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.rst
__init__.py
og.py

README.rst

Pilosus Open Graph Pluging

Expand Article and Page entities with Open Graph Protocol tags.

Installation

  1. Place plugin in a directory, e.g plugins/pilosus_pelican_og. You can clone it or add it to your blog repo as a submodule:
$ cd /path/to/your/static/site/repo
$ git submodule add https://github.com/pilosus/pilosus_pelican_og plugins/pilosus_pelican_og
  1. Add plugins configurations in a settings file:
PLUGIN_PATHS = ['plugins']
PLUGINS = ['pilosus_pelican_og',]

Usage

  1. Use the following tags in your content's metadata section:
og_title (article title used by default)
og_type (article by default)
og_image (abolute or relative path to an image, DEFAULT_OG_IMAGE config used by default)
og_url
og_description (summary used by default)
og_locale (LOCALE config used by default)
og_site_name
og_see_also
article_author
article_published_time
article_modified_time
article_section
article_tag
  1. Place this snippet in your base.html template inside of the head tag:
{% if article and article.og %}
{% for tag in article.og %}
<meta property="{{tag[0]}}" content="{{tag[1]|striptags|e}}" />
{% endfor %}
{% endif %}

{% if page and page.og %}
{% for tag in page.og %}
<meta property="{{tag[0]}}" content="{{tag[1]|striptags|e}}" />
{% endfor %}
{% endif %}

License

This work is based upon an original work of whiskyechobravo that can be found under: https://github.com/whiskyechobravo/pelican-open_graph

This work is licensed under GNU AFFERO GENERAL PUBLIC LICENSE Version 3

You can’t perform that action at this time.