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

Use Canonical URL for ogp_site_url

Open ItayZiv opened this issue 3 years ago • 4 comments

~~Getting og:url automatically in RTD using html_baseurl doesn't work.~~ We probably want to use html_baseurl when ogp_sire_url isn't set regardless of if we are in an RTD environment. It might be better to recommend users to set html_baseurl and only set ogp_site_url if they need it to be different than the normal canonical URL.

ItayZiv avatar Feb 24 '22 17:02 ItayZiv

Why doesn't it work on RTD?

TheTripleV avatar Feb 25 '22 03:02 TheTripleV

If you look at the og tags of the website of this extension you will see the website tag is just the page name. ~~I'm quite sure this is because you can't modify the config object.~~ My bad I missed something, still need to check why this happens tho. I want to use this opportunity to use html_baseurl even not in RTD.'

Edit: Basically I think that we should have it set up so that html_baseurl is used unless ogp_site_url is set, if it is set use ogp_site_url. If both aren't configured, raise an exception.

ItayZiv avatar Feb 25 '22 14:02 ItayZiv

It seems that when I check the PR docs build (and the PR build on other PRs) it actually seems to get the correct URL (https://sphinxext-opengraph.readthedocs.io/en/latest/index.html). Regardless I'd still like to do the aforementioned html_baseurl change, but not really sure why the latest docs don't work.

ItayZiv avatar Feb 25 '22 15:02 ItayZiv

Actually, it seems like these are two separate matters, the docs links to https://sphinxext-opengraph.readthedocs.io/en/latest/ as the default, yet the latest branch is not updated, while https://sphinxext-opengraph.readthedocs.io/en/stable is updated and also has og:url linked to https://sphinxext-opengraph.readthedocs.io/en/latest/index.html. I split this into #57, while this issue can remain for changing the extension to use html_baseurl outside of RTD (and refractoring the way this is currently done)

ItayZiv avatar Feb 25 '22 16:02 ItayZiv