We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9dbff79 commit 8029089Copy full SHA for 8029089
sphinxext/opengraph/__init__.py
@@ -119,6 +119,7 @@ def get_tags(
119
120
fields.pop("og:image:alt", None)
121
122
+ first_image = None
123
if ogp_use_first_image:
124
first_image = doctree.next_node(nodes.image)
125
if (
@@ -134,12 +135,12 @@ def get_tags(
134
135
image_url_parsed = urlparse(image_url)
136
if not image_url_parsed.scheme:
137
# Relative image path detected, relative to the source. Make absolute.
- if config["ogp_image"]:
138
+ if first_image:
139
+ root = page_url
140
+ else:
141
# ogp_image is defined as being relative to the site root.
142
# This workaround is to keep that functionality from breaking.
143
root = config["ogp_site_url"]
- else:
- root = page_url
144
145
image_url = urljoin(root, image_url_parsed.path)
146
tags["og:image"] = image_url
0 commit comments