All Projects → wpilibsuite → sphinxext-opengraph

wpilibsuite / sphinxext-opengraph

Licence: other
Sphinx extension to generate unique OpenGraph metadata

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to sphinxext-opengraph

sphinx-substitution-extensions
Extensions for Sphinx which allow substitutions
Stars: ✭ 32 (+10.34%)
Mutual labels:  sphinx-extension
restbuilder
A Sphinx builder/writer to output reStructuredText (rst) files
Stars: ✭ 25 (-13.79%)
Mutual labels:  sphinx-extension
emojicodes
An extension to use emoji codes in your Sphinx documentation! 😍
Stars: ✭ 39 (+34.48%)
Mutual labels:  sphinx-extension
sphinx-hoverxref
Sphinx extension to show tooltips with content embedded when hover a reference.
Stars: ✭ 77 (+165.52%)
Mutual labels:  sphinx-extension
sphinx-toolbox
Box of handy tools for Sphinx 🧰 📔
Stars: ✭ 55 (+89.66%)
Mutual labels:  sphinx-extension
plantuml
No description or website provided.
Stars: ✭ 87 (+200%)
Mutual labels:  sphinx-extension
sphinx-revealjs
Presentation builder for Pythonista
Stars: ✭ 56 (+93.1%)
Mutual labels:  sphinx-extension
sphinx-prompt
Sphinx directive to add unselectable prompt
Stars: ✭ 39 (+34.48%)
Mutual labels:  sphinx-extension
sphinxcontrib-hdl-diagrams
Sphinx Extension which generates various types of diagrams from Verilog code.
Stars: ✭ 37 (+27.59%)
Mutual labels:  sphinx-extension
readthedocs-sphinx-search
Enable search-as-you-type feature for docs hosted by RTD.
Stars: ✭ 24 (-17.24%)
Mutual labels:  sphinx-extension
httpdomain
Documenting RESTful HTTP APIs
Stars: ✭ 51 (+75.86%)
Mutual labels:  sphinx-extension
sphinx-codeautolink
Automatic links from code examples to reference documentation
Stars: ✭ 41 (+41.38%)
Mutual labels:  sphinx-extension
sphinxcontrib-jupyter
A Sphinx Extension for Generating Jupyter Notebooks
Stars: ✭ 72 (+148.28%)
Mutual labels:  sphinx-extension
sphinxext-rediraffe
Sphinx extension to redirect files
Stars: ✭ 27 (-6.9%)
Mutual labels:  sphinx-extension
sphinx rtd dark mode
Adds a toggleable dark mode to the Read the Docs theme for Sphinx.
Stars: ✭ 29 (+0%)
Mutual labels:  sphinx-extension
sphinxcontrib-django
This is a sphinx extension which improves the documentation of Django apps.
Stars: ✭ 37 (+27.59%)
Mutual labels:  sphinx-extension
sphinxcontrib-programoutput
Sphinx extension for capturing program output
Stars: ✭ 29 (+0%)
Mutual labels:  sphinx-extension
sphinx-wavedrom
A sphinx extension that allows including wavedrom diagrams by using its text-based representation
Stars: ✭ 26 (-10.34%)
Mutual labels:  sphinx-extension
matlabdomain
A Sphinx extension for documenting Matlab code
Stars: ✭ 34 (+17.24%)
Mutual labels:  sphinx-extension
autodoc pydantic
Seamlessly integrate pydantic models in your Sphinx documentation.
Stars: ✭ 60 (+106.9%)
Mutual labels:  sphinx-extension

sphinxext-opengraph

Build Code style: black

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.

Users hosting documentation on Read The Docs do not need to set any of the following unless custom configuration is wanted. The extension will automatically retrieve your site url.

  • 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. Note that all relative paths are converted to be relative to the root of the html output as defined by ogp_site_name.
  • 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 to False if you want to turn off alt text completely.
  • ogp_use_first_image
    • This is not required. Set to True to use each page's first image, if available. If set to True but no image is found, Sphinx will use ogp_image instead.
  • 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.
  • 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" />',
]

Per Page Overrides

Field lists are used to allow you to override certain settings on each page and set unsupported arbitrary OpenGraph tags.

Make sure you place the fields at the very start of the document such that Sphinx will pick them up and also won't build them into the html.

Overrides

These are some overrides that can be used, you can actually override any tag and field lists will always take priority.

  • :og_description_length:
    • Configure the amount of characters to grab for the description of the page. If the value isn't a number it will fall back to ogp_description_length. Note the slightly different syntax because this isn't directly an OpenGraph tag.
  • :og:description:
    • Lets you override the description of the page.
  • :og:title:
    • Lets you override the title of the page.
  • :og:type:
  • :ogp:image:
    • Set the image for the page.1
  • :ogp:image:alt:
    • Sets the alt text. Will be ignored if there is no image set.

Example

Remember that the fields must be placed at the very start of the file. You can verify Sphinx has picked up the fields if they aren't shown in the final html file.

:og:description: New description
:og:image: http://example.org/image.png
:og:image:alt: Example Image

Page contents
=============

Arbitrary Tags1

Additionally, you can use field lists to add any arbitrary OpenGraph tag not supported by the extension. The syntax for arbitrary tags is the same with :og:tag: content. For Example:

:og:video: http://example.org/video.mp4

Page contents
=============

Footnotes

  1. Note: Relative file paths for images, videos and audio are currently not supported when using field lists. Please use an absolute path instead. 2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].