-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Sphinx and docutils provide the meta directive where arbitrary HMTL metadata can be set, such as description
, og:image
, og:title
etc. This can be used to set per-document metadata, but there is no facility (that I have been able to find) to provide default values for these fields.
Best solution: Provide a dictionary in the conf file that gives default values for the html meta data that can be overridden by the meta directive for specific documents
Alternative solution: make the metatags
template variable available as a dictionary, it is a pre-rendered string. Right now I parse this string to figure out if there have been any meta overrides defined in the local document. This is of course an ugly hack. The best would be to provide this only as a dictionary, but that is probably not very backwards compatible with any existing theme ... It could be that making metatags
a special dict that implements __str__
could maybe work? Anyway, providing overridable default values would be preferable.
For context: Providing proper html metadata is good for search engines, and providing OpenGraph og:*
metadata lets web pages make links to the documentation that looks nice and attractive for sharing on Twitter, Facebook, LinkedIn and other pages that provide OpenGraph support.