Skip to content

Commit 5556017

Browse files
authored
Revert "Add option to use og:description as description (#71)"
This reverts commit 0dc991c.
1 parent 0dc991c commit 5556017

File tree

5 files changed

+3
-30
lines changed

5 files changed

+3
-30
lines changed

docs/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
# This pattern also affects html_static_path and html_extra_path.
4545
exclude_patterns = []
4646

47-
# Generate <meta name="description" content="..."> tags.
48-
enable_meta_description = True
4947

5048
# -- Options for HTML output -------------------------------------------------
5149

sphinxext/opengraph/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
}
2929

3030

31-
def make_tag(property: str, content: str, type_: str = "property") -> str:
31+
def make_tag(property: str, content: str) -> str:
3232
# Parse quotation, so they won't break html tags if smart quotes are disabled
3333
content = content.replace('"', "&quot;")
34-
return f'<meta {type_}="{property}" content="{content}" />\n '
34+
return f'<meta property="{property}" content="{content}" />\n '
3535

3636

3737
def get_tags(
@@ -104,10 +104,6 @@ def get_tags(
104104
# description tag
105105
if description:
106106
tags["og:description"] = description
107-
if config["enable_meta_description"]:
108-
config["ogp_custom_meta_tags"].append(
109-
make_tag("description", description, "name")
110-
)
111107

112108
# image tag
113109
# Get basic values from config
@@ -187,7 +183,6 @@ def setup(app: Sphinx) -> Dict[str, Any]:
187183
app.add_config_value("ogp_type", "website", "html")
188184
app.add_config_value("ogp_site_name", None, "html")
189185
app.add_config_value("ogp_custom_meta_tags", [], "html")
190-
app.add_config_value("enable_meta_description", False, "html")
191186

192187
app.connect("html-page-context", html_page_context)
193188

tests/roots/test-meta-name-description/conf.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/roots/test-meta-name-description/index.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/test_options.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22
from sphinx.application import Sphinx
33
import conftest
4+
import os
45

56

67
def get_tag(tags, tag_type):
@@ -25,16 +26,6 @@ def test_simple(og_meta_tags):
2526
)
2627

2728

28-
@pytest.mark.sphinx("html", testroot="meta-name-description")
29-
def test_meta_name_description(meta_tags):
30-
og_description = get_tag_content(meta_tags, "description")
31-
description = [tag for tag in meta_tags if tag.get("name") == "description"][0].get(
32-
"content", ""
33-
)
34-
35-
assert og_description == description
36-
37-
3829
@pytest.mark.sphinx("html", testroot="simple")
3930
def test_site_url(og_meta_tags):
4031
# Uses the same directory as simple, because it already contains url for a minimal config

0 commit comments

Comments
 (0)