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_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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6418a810afd9c5b1c8e507c9121ec23f931fdcce0f9f69f49e4a982905f18225 |
|
MD5 | 109e5a17e786aa666c9a08faa8f6d67b |
|
BLAKE2b-256 | c3d91202535ebcdd0dfd4266e4eaaea1826028fe6b6e2b72dec4d104247e6ee6 |
Close
Hashes for sphinxext_opengraph-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4b08662b5c36af4752974df829b938c93746193c7acc7997126e999e5a5e267 |
|
MD5 | 3dbfd989acf91cdf0f08e8f45479c9f4 |
|
BLAKE2b-256 | 0008fdb556895d7b808e33a8a4c5c9b32bc2e2cb0f477a582447b281008b8e77 |