Add Open Graph tags for better link preview on social media

This is provided by the sphinxext-opengraph extension.

This also adds a theme color property in the HTML layout file.

(cherry picked from commit 9becaa5480)
This commit is contained in:
Hugo Locurcio
2021-03-18 20:19:43 +01:00
committed by Rémi Verschelde
parent 0175c3e4fe
commit 6c87f04926
3 changed files with 8 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
{% extends "!layout.html" -%}
{% block linktags -%}
<meta name="theme-color" content="#3d8fcc">
{% if godot_inject_language_links -%}
{% for alternate_lang in godot_docs_supported_languages -%}
{# Convert to ISO 639-1 format, e.g. zh_CN -> zh-cn -#}

View File

@@ -15,6 +15,7 @@ sys.path.append(os.path.abspath("_extensions"))
extensions = [
"sphinx_tabs.tabs",
"notfound.extension",
"sphinxext.opengraph",
]
# Warning when the Sphinx Tabs extension is used with unknown
@@ -54,6 +55,9 @@ on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if not on_rtd:
notfound_urls_prefix = ''
# Specify the site name for the Open Graph extension.
ogp_site_name = "Godot Engine documentation"
if not os.getenv("SPHINX_NO_GDSCRIPT"):
extensions.append("gdscript")

View File

@@ -12,5 +12,8 @@ sphinx-tabs==1.1.13
# Custom 404 error page (more useful than the default)
sphinx-notfound-page==0.6
# Adds Open Graph tags in the HTML `<head>` tag
sphinxext-opengraph==0.4.1
# Full-page search UI for RTD: https://readthedocs-sphinx-search.readthedocs.io
readthedocs-sphinx-search==0.1.0rc3