Sphinx Extension to enable OGP support
Project description
sphinxext-opengraph
Sphinx extension to generate OpenGraph metadata (https://ogp.me/)
Installation
python -m pip install sphinxext-opengraph
Usage
Just add sphinxext.opengraph
to your extensions list in your conf.py
extensions = [
sphinxext.opengraph,
]
Options
These values are placed in the conf.py of your sphinx project.
ogp_site_url
- This config option is very important, set it to the URL the site is being hosted on.
ogp_description_length
- Configure the amount of characters taken from a page. The default of 200 is probably good for most people. If something other than a number is used, it defaults back to 200.
ogp_site_name
- This is not required. Name of the site. This is displayed above the title.
ogp_image
- This is not required. Link to image to show.
ogp_image_alt
- This is not required. Alt text for image. Defaults to using
ogp_site_name
or the document's title as alt text, if available. Set toFalse
if you want to turn off alt text completely.
- This is not required. Alt text for image. Defaults to using
ogp_type
- This sets the ogp type attribute, for more information on the types available please take a look at https://ogp.me/#types. By default it is set to
website
, which should be fine for most use cases.
- This sets the ogp type attribute, for more information on the types available please take a look at https://ogp.me/#types. By default it is set to
ogp_custom_meta_tags
- This is not required. List of custom html snippets to insert.
Example Config
Simple Config
ogp_site_url = "http://example.org/"
ogp_image = "http://example.org/image.png"
Advanced Config
ogp_site_url = "http://example.org/"
ogp_image = "http://example.org/image.png"
ogp_description_length = 300
ogp_type = "article"
ogp_custom_meta_tags = [
'<meta property="og:ignore_canonical" content="true" />',
]
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
Close
Hashes for sphinxext-opengraph-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6be7e964ed3c331cfa13485458552815114a9b64074f22f0a89c97d03105408a |
|
MD5 | 25397f60dc57ab915a34ed15b6da05e3 |
|
BLAKE2b-256 | 07bfb56976c062c79b2694dda030cbf8ae29fa2834c4d3b59a07aa2ac080577f |
Close
Hashes for sphinxext_opengraph-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e82c78b1ece915653d53162056959bf72e20286f7873a0492385ad240e995813 |
|
MD5 | 650f822efb16cb1877da7191f85fbb61 |
|
BLAKE2b-256 | d8cb8402021333a82fd80351c82f42374e9b5a553d1d50a23befdc8f196dd0b7 |