sphinxext-opengraph icon indicating copy to clipboard operation
sphinxext-opengraph copied to clipboard

Add global `og:description` override

Open wiktor-k opened this issue 1 year ago • 3 comments

Hi,

I'd like to keep my og:description in the Sphinx conf.py file and not clutter the input files.

I've used this to insert the tag:

ogp_custom_meta_tags = [
    f'<meta property="og:description" content="{description}" />',
]

Sadly the generator still inserts automated og:description parsed from the site that's completely irrelevant:

<meta property="og:description" content="2023-12-13 Introducing OpenPGP- What is OpenPGP?, Who is the audience for this document?, Why not just use the OpenPGP RFC?, Which version of OpenPGP does this address?., A high-level view- Why Ope..." />
<meta property="og:description" content="The essential OpenPGP guide for application developers. Learn the OpenPGP standard for cryptographic operations and how to implement it in your projects. Gain insights into digital signatures, key management, certificates, and more. Version agnostic." />

Is there a way to globally override og:description or completely disable the automated generation? (I've checked the README but couldn't find any leads).

Thanks for your help! :wave:

wiktor-k avatar Dec 13 '23 10:12 wiktor-k

I'd probably argue you should just add your meta tags to a template. Overriding the description breaks one of the core reasons for this extension.

Can I ask what purpose you need to override for?

Daltz333 avatar Dec 13 '23 18:12 Daltz333

I'm actually happy with the rest of the tags that the extension inserts (the rest of the OpenGraph tags).

But as you mention it's possible to do the same via raw template markup (but then I'd be replicating most of what this extension provides eg generation of og:url).

For the record the site is at https://openpgp.dev/book/

If you consider this out of scope it's okay with me but I still wanted to clarify with you what would be the best approach. I hope you don't mind.

wiktor-k avatar Dec 13 '23 18:12 wiktor-k

@TheTripleV thoughts?

Daltz333 avatar Dec 14 '23 11:12 Daltz333