wpilibsuite / sphinxext-opengraph

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

Custom description (?) #41

Closed eguidotti closed 3 years ago

eguidotti commented 3 years ago

Thanks for the nice package! I'm wondering if there is a way to set up a custom og:description tag for a given page. I tried via the ogp_custom_meta_tags but this generates two og:description tags (the default one + custom tag). Would it be possible to remove the default og:description if it is provided in ogp_custom_meta_tags?

Also, it seems that og:description is ignoring the html description meta tag. Shouldn't it match the html description meta tag if it is provided?

Many thanks!

Daltz333 commented 3 years ago

This is already being resolved by a WIP PR https://github.com/wpilibsuite/sphinxext-opengraph/pull/35

Also, we can't just detect when standard html description is being used because ReadTheDocs overrides this for all projects, and using that will sorta defeat the purpose of intelligent OpenGraph descriptions.

eguidotti commented 3 years ago

Thanks a lot for your answer! That's great it is already solved.

Would you mind sharing a code snippet to override the og:description? Or link to some resources to understand how to do that? I've been trying to browse PR #35 but I'm still not able to override the description.

Many thanks!

eguidotti commented 3 years ago

Mmm, I just realized that #35 is unmerged so it looks like the issue isn't solved yet. I opened #42 specifically for og:description and avoid printing an empty tag. Hope this makes sense :)

TheTripleV commented 3 years ago

There currently is not a way to specify custom tags on a per-page level with this extension.

I had begun the work to add that functionality at https://github.com/TheTripleV/sphinxext-opengraph/tree/injections2. I'll pickup work on this feature again soon.

ogp_custom_meta_tags adds the specified metadata to all pages, which I would not recommend for a description.

eguidotti commented 3 years ago

@TheTripleV Thanks for your efforts on this project! Yes I agree that the custom meta tags would not be recommended for the description. But mine is a very small website and it would do the trick :)

eguidotti commented 3 years ago

42 works like a charm. I guess I can close this issue and wait for #35 to be merged. Thanks again!