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

Social card links can be broken in multiversioned documentations

Open illia-v opened this issue 1 year ago • 2 comments

urllib3 has recently started relying on sphinxext-opengraph. In https://github.com/urllib3/urllib3/pull/3064 I tried setting up social cards, but ended up facing problems related to canonical URLs in Read the Docs.

urllib3 has docs for multiple versions of the package and for every new pull request.

sphinxext-opengraph seems to always start URLs of the cards with https://urllib3.readthedocs.io/en/stable/ regardless of the docs version (for example, at https://urllib3--3064.org.readthedocs.build/en/3064/.)

This leads to a problem that a score card linked in og:image is not available in any docs version until it is deployed to "stable".

But even after it is deployed there, there is a high chance that og:image in other versions will lead to a nonexistent image because of the hash in the filename affected by multiple details of a page.

illia-v avatar Jun 08 '23 17:06 illia-v

Relying on READTHEDOCS_CANONICAL_URL like in https://github.com/readthedocs/readthedocs.org/pull/10224 looks to be a solution

illia-v avatar Jun 08 '23 20:06 illia-v

Yep. I'm pretty sure that's what we did over in frc-docs. Development motivation has been slow as of late, but we're always open to reviewing contributions.

Daltz333 avatar Jul 07 '23 01:07 Daltz333