Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build docs with sphinx_copybutton and sphinxext.opengraph #5498

Merged
merged 6 commits into from
May 17, 2021

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented May 14, 2021

Changes proposed in this pull request:

Open graph

For example, These tags are inserted into the tutorial page:

<meta property="og:title" content="Tutorial" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://pillow.readthedocs.io/en/stable/handbook/tutorial.html" />
<meta property="og:description" content="Using the Image class: The most important class in the Python Imaging Library is the Image class, defined in the module with the same name. You can create instances of this class in several ways; e..." />

https://pillow--5498.org.readthedocs.build/en/5498/handbook/tutorial.html

Can compare what Facebook extracts from the PR:

https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Fpillow--5498.org.readthedocs.build%2Fen%2F5498%2Fhandbook%2Ftutorial.html

with stable:

https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Fpillow.readthedocs.io%2Fen%2Fstable%2Fhandbook%2Ftutorial.html

Copy button

The button at the top right copies the code block to the clipboard

image

https://pillow--5498.org.readthedocs.build/en/5498/handbook/tutorial.html#convert-files-to-jpeg

TODO

  • Install plugins in .github/workflows/test.yml
  • I'll update the PR to include the logo in og:image

@hugovk hugovk marked this pull request as draft May 14, 2021 17:08
@hugovk
Copy link
Member Author

hugovk commented May 14, 2021

Added og:image:

image

https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Fpillow--5498.org.readthedocs.build%2Fen%2F5498%2F

I hotlinked to https://github.com/python-pillow/pillow-logo/blob/master/pillow-logo-dark-text-1280x640.png using:

https://raw.githubusercontent.com/python-pillow/pillow-logo/master/pillow-logo-dark-text-1280x640.png

It's the right size, https://developers.facebook.com/docs/sharing/webmasters/images/ says:

  • The minimum allowed image dimension is 200 x 200 pixels.
  • The size of the image file must not exceed 8 MB.
  • Use images that are at least 1200 x 630 pixels for the best display on high resolution devices. At the minimum, you should use images that are 600 x 315 pixels to display link page posts with larger images.
  • We've also re-designed link page posts so that the aspect ratio for images is the same across desktop and mobile News Feed. Try to keep your images as close to 1.91:1 aspect ratio as possible to display the full image in News Feed without any cropping.

@hugovk hugovk marked this pull request as ready for review May 14, 2021 18:54
Set og:image:alt to be constant
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@radarhere radarhere merged commit ae0efcb into python-pillow:master May 17, 2021
@hugovk hugovk deleted the improve-docs branch May 17, 2021 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants