-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added OpenGraph information to the documentation configuration #3034
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
Added OpenGraph information to the documentation configuration #3034
Conversation
@Mr-Sunglasses Thanks for this! It looks like the docs build is failing though, can you take a look? |
I have Updated the |
ogp_title = "urllib3 documentation" | ||
ogp_site_url = "https://urllib3.readthedocs.io" | ||
ogp_type = "website" | ||
ogp_image = "https://github.com/urllib3/urllib3/raw/main/docs/_static/banner_github.svg" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenGraph does not support SVG, use a PNG instead:
https://stackoverflow.com/a/26876671/724176
Compare python-pillow/Pillow#5498
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that with the following change, it generates social cards for every page
diff --git a/docs/conf.py b/docs/conf.py
index 69f5c4dd..a2a93fdb 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -42,7 +42,7 @@ extensions = [
ogp_title = "urllib3 documentation"
ogp_site_url = "https://urllib3.readthedocs.io"
ogp_type = "website"
-ogp_image = "https://github.com/urllib3/urllib3/raw/main/docs/_static/banner_github.svg"
+ogp_social_cards = {"image": "images/logo.png", "line_color": "#F09837"}
ogp_description = "urllib3 is a user-friendly HTTP client library for Python."
# Test code blocks only when explicitly specified
@sethmlarson @pquentin what do you this about using them instead of a static image?
FYI, the little icon is Sphinx's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, the logo is enough here, urllib3
is already mentioned multiple times.
] | ||
|
||
# Open Graph metadata | ||
ogp_title = "urllib3 documentation" | ||
ogp_site_url = "https://urllib3.readthedocs.io" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, the Facebook sharing debugger gets 404s for /latest
URLs:
https://urllib3.readthedocs.io/en/latest/advanced-usage.html
I wonder if it's this line causing mixup with the canonical link.
We don't use it for Pillow (see above) and https://github.com/wpilibsuite/sphinxext-opengraph#options says:
Users hosting documentation on Read The Docs do not need to set any of the following unless custom configuration is wanted.
And as a bonus there's also a "theme colour" you can set: python/devguide#953 (comment) For example: |
@hugovk will fix it as soon as possible 😊 |
@Mr-Sunglasses Were you still up for fixing these issues? Otherwise someone else may tackle them in the next few days to get a release out. |
@sethmlarson Will fix it by today 👍🏻 |
I can see we refer to a |
We can omit |
This is nice, thanks for the info! |
Fix #1983 Added the OpenGraph information metadata to the documentation configuration so that it looks nice when shared on the platforms supporting The Open Graph protocol.