Skip to content

Commit 4f93d75

Browse files
authored
Fix opengraph (#77)
* fix: Corrected OpenGraph metadata generation in sphinxtxt * fix: Corrected OpenGraph metadata generation in sphinxtxt - update page.html static metadata * docs: translate comments to English * docs: translate comment to English in conf.py
1 parent 7e290fe commit 4f93d75

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

_templates/page.html

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
{%- extends "!page.html" %}
22

3-
{%- block extrahead %}
4-
<meta name="robots" content="follow, index">
5-
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
6-
{{ super() }}
7-
{% endblock extrahead %}
3+
{% block extrahead %}
4+
{{ super() }}
5+
6+
{# Verifies sphinx_version availability before rendering metatags
7+
This check is crucial to prevent errors during site generation
8+
when sphinxext.opengraph extension is not available #}
9+
{% if sphinx_version %}
10+
{{ metatags }}
11+
{% endif %}
12+
13+
{# Static meta tags manually defined to ensure consistency
14+
These tags will remain unchanged regardless of Sphinx configuration
15+
or its extensions, ensuring a constant site identity #}
16+
<meta name="robots" content="follow, index">
17+
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
18+
{% endblock %}

conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,5 @@
432432
"line_color": "#4078c0",
433433
"image": "_static/logo/logo.png",
434434
}
435+
# Ensures og:image meta tag generation which is not always generated by sphinxext.opengraph
436+
ogp_image = "_static/logo/logo.png"

0 commit comments

Comments
 (0)