Skip to content

Commit 51b3150

Browse files
authored
Docs: Add opengraph (#10066)
* Add opengraph to our docs * Add opengraph conf * Tweak opengraph a bit more * More small tweaks * Use prod image url, since relative doesn't work
1 parent 8c9b759 commit 51b3150

File tree

4 files changed

+46
-9
lines changed

4 files changed

+46
-9
lines changed

docs/_static/img/logo-opengraph.png

20.6 KB
Loading

docs/conf.py

+18-8
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@
1818

1919
sys.path.append(os.path.abspath("_ext"))
2020
extensions = [
21+
"hoverxref.extension",
2122
"multiproject",
22-
"sphinx.ext.autosectionlabel",
23+
"myst_parser",
24+
"notfound.extension",
25+
"sphinx_design",
26+
"sphinx_search.extension",
27+
"sphinx_tabs.tabs",
28+
"sphinx-prompt",
2329
"sphinx.ext.autodoc",
30+
"sphinx.ext.autosectionlabel",
2431
"sphinx.ext.extlinks",
2532
"sphinx.ext.intersphinx",
2633
"sphinxcontrib.httpdomain",
2734
"sphinxcontrib.video",
28-
"sphinx_tabs.tabs",
29-
"sphinx-prompt",
30-
"notfound.extension",
31-
"hoverxref.extension",
32-
"sphinx_search.extension",
3335
"sphinxemoji.sphinxemoji",
34-
"sphinx_design",
35-
"myst_parser",
36+
"sphinxext.opengraph",
3637
]
3738

3839
multiproject_projects = {
@@ -52,6 +53,15 @@
5253

5354
docset = get_project(multiproject_projects)
5455

56+
ogp_site_name = "Read the Docs Documentation"
57+
ogp_use_first_image = True # https://github.com/readthedocs/blog/pull/118
58+
ogp_image = "https://docs.readthedocs.io/en/stable/_static/img/logo-opengraph.png"
59+
# Inspired by https://github.com/executablebooks/MyST-Parser/pull/404/
60+
ogp_custom_meta_tags = [
61+
'<meta name="twitter:card" content="summary_large_image" />',
62+
]
63+
ogp_enable_meta_description = True
64+
ogp_description_length = 300
5565

5666
templates_path = ["_templates"]
5767

requirements/docs.in

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ sphinxemoji
1717
sphinxcontrib-httpdomain
1818
sphinx-prompt
1919
sphinx-autobuild
20+
sphinxext-opengraph
2021

2122
# Markdown
2223
myst_parser

requirements/docs.txt

+27-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ click==8.1.3
1818
# via sphinx-intl
1919
colorama==0.4.6
2020
# via sphinx-autobuild
21+
contourpy==1.0.7
22+
# via matplotlib
23+
cycler==0.11.0
24+
# via matplotlib
2125
docutils==0.18.1
2226
# via
2327
# myst-parser
2428
# sphinx
2529
# sphinx-rtd-theme
2630
# sphinx-tabs
31+
fonttools==4.38.0
32+
# via matplotlib
2733
idna==3.4
2834
# via requests
2935
imagesize==1.4.1
@@ -32,6 +38,8 @@ jinja2==3.1.2
3238
# via
3339
# myst-parser
3440
# sphinx
41+
kiwisolver==1.4.4
42+
# via matplotlib
3543
livereload==2.6.3
3644
# via sphinx-autobuild
3745
markdown-it-py==2.1.0
@@ -40,21 +48,35 @@ markdown-it-py==2.1.0
4048
# myst-parser
4149
markupsafe==2.1.2
4250
# via jinja2
51+
matplotlib==3.7.0
52+
# via sphinxext-opengraph
4353
mdit-py-plugins==0.3.4
4454
# via myst-parser
4555
mdurl==0.1.2
4656
# via markdown-it-py
4757
myst-parser==0.18.1
4858
# via -r requirements/docs.in
59+
numpy==1.24.2
60+
# via
61+
# contourpy
62+
# matplotlib
4963
packaging==23.0
50-
# via sphinx
64+
# via
65+
# matplotlib
66+
# sphinx
5167
pbr==5.11.1
5268
# via sphinxcontrib-video
69+
pillow==9.4.0
70+
# via matplotlib
5371
pygments==2.14.0
5472
# via
5573
# sphinx
5674
# sphinx-prompt
5775
# sphinx-tabs
76+
pyparsing==3.0.9
77+
# via matplotlib
78+
python-dateutil==2.8.2
79+
# via matplotlib
5880
pytz==2022.7.1
5981
# via babel
6082
pyyaml==6.0
@@ -66,6 +88,7 @@ requests==2.28.2
6688
six==1.16.0
6789
# via
6890
# livereload
91+
# python-dateutil
6992
# sphinxcontrib-httpdomain
7093
snowballstemmer==2.2.0
7194
# via sphinx
@@ -83,6 +106,7 @@ sphinx==5.3.0
83106
# sphinx-tabs
84107
# sphinxcontrib-httpdomain
85108
# sphinxemoji
109+
# sphinxext-opengraph
86110
sphinx-autobuild==2021.3.14
87111
# via -r requirements/docs.in
88112
sphinx-design==0.3.0
@@ -123,6 +147,8 @@ sphinxcontrib-video @ git+https://github.com/readthedocs/sphinxcontrib-video/
123147
# via -r requirements/docs.in
124148
sphinxemoji==0.2.0
125149
# via -r requirements/docs.in
150+
sphinxext-opengraph==0.8.1
151+
# via -r requirements/docs.in
126152
tornado==6.2
127153
# via livereload
128154
typing-extensions==4.5.0

0 commit comments

Comments
 (0)