sphinx-doc / sphinx-doc/sphinx
Let user provide default values of html metatags
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the meta directive and the metatags template variable through Sphinx's HTML output and configuration handling. Compare the proposed configuration dictionary with the template-variable alternative, including compatibility with existing themes; done means default metadata is emitted and document-level meta values override it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100