python / docsbuild-scripts

scripts for building documentation on docs.python.org
63 stars 56 forks source link

Deploying extra images with docs #147

Open hugovk opened 1 year ago

hugovk commented 1 year ago

Hi @ewdurbin and @JulienPalard!

We recently added sphinxext-opengraph to the CPython docs and devguide, to add metadata to pages to improve SEO: https://github.com/python/docs-community/issues/63#issuecomment-1332201334

That extension has a new PR open to generate social media cards for each page: https://github.com/wpilibsuite/sphinxext-opengraph/pull/88

Some examples at: https://sphinxext-opengraph--88.org.readthedocs.build/en/88/socialcards.html

I've also built demos at:

The images are good, here's a random example:

For CPython docs it generates some 482 images, 41 MB.

(devguide is 52 images at 4.3 MB)

Do you think that would be a problem for the CPython docs deployments?

ewdurbin commented 1 year ago

I can't say with certainty, though if this is controllable it really only makes sense to do for "online" builds we'll be serving from docs.python.org, right?

In that case how do we handle translations? Would the social card be generated for each translation of the docs? Does open graph have any consideration for localization?

Depending on how many permutations of the images are created, it could be an issue but even still 41MB per version per translation isn't a huge increase over current sizes. I do think it would be important to ensure they aren't bundled with the archives though.

Just my considerations... I think that exhausts my familiarity :)

hugovk commented 1 year ago

I can't say with certainty, though if this is controllable it really only makes sense to do for "online" builds we'll be serving from docs.python.org, right?

Yes, only makes sense for online builds. We can control by either not installing the extension, or via config. But will have to double check this.

In that case how do we handle translations? Would the social card be generated for each translation of the docs? Does open graph have any consideration for localization?

Good question, we'll need to test this too. I think it'll be fine because all the text in the screenshot above is taken from the docs. We can disable for translations to begin with.

Depending on how many permutations of the images are created, it could be an issue but even still 41MB per version per translation isn't a huge increase over current sizes. I do think it would be important to ensure they aren't bundled with the archives though.

Yes, we may need to check that the number of images doesn't cause a problem, but we have the ~same number of HTML files.

Just my considerations... I think that exhausts my familiarity :)

Thanks!