Skip to content

Commit

Permalink
Add Open Graph tags for better link preview on social media
Browse files Browse the repository at this point in the history
This is provided by the sphinxext-opengraph extension.

This also adds a theme color property in the HTML layout file.
  • Loading branch information
Calinou committed Mar 18, 2021
1 parent e3b46ea commit 9becaa5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions _templates/layout.html
Original file line number Diff line number Diff line change
@@ -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 -#}
Expand Down
4 changes: 4 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
extensions = [
"sphinx_tabs.tabs",
"notfound.extension",
"sphinxext.opengraph",
]

# Warning when the Sphinx Tabs extension is used with unknown
Expand Down Expand Up @@ -54,6 +55,9 @@
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")

Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ sphinx-tabs==2.1.0
# 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.0

0 comments on commit 9becaa5

Please sign in to comment.