wpilibsuite / sphinxext-opengraph

Sphinx extension to generate unique OpenGraph metadata
https://sphinxext-opengraph.readthedocs.io
Other
69 stars 25 forks source link

Add global `og:description` override #117

Open wiktor-k opened 7 months ago

wiktor-k commented 7 months ago

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:

Daltz333 commented 7 months ago

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?

wiktor-k commented 7 months ago

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.

Daltz333 commented 7 months ago

@TheTripleV thoughts?