Skip to content

Commit

Permalink
Revert "Add option to use og:description as description (#71)" (#73)
Browse files Browse the repository at this point in the history
This reverts commit 0dc991c.
  • Loading branch information
TheTripleV authored Oct 21, 2022
1 parent 0dc991c commit be9a41d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 30 deletions.
2 changes: 0 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# Generate <meta name="description" content="..."> tags.
enable_meta_description = True

# -- Options for HTML output -------------------------------------------------

Expand Down
9 changes: 2 additions & 7 deletions sphinxext/opengraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
}


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


def get_tags(
Expand Down Expand Up @@ -104,10 +104,6 @@ def get_tags(
# description tag
if description:
tags["og:description"] = description
if config["enable_meta_description"]:
config["ogp_custom_meta_tags"].append(
make_tag("description", description, "name")
)

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

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

Expand Down
10 changes: 0 additions & 10 deletions tests/roots/test-meta-name-description/conf.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/roots/test-meta-name-description/index.rst

This file was deleted.

11 changes: 1 addition & 10 deletions tests/test_options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from sphinx.application import Sphinx
import conftest
import os


def get_tag(tags, tag_type):
Expand All @@ -25,16 +26,6 @@ def test_simple(og_meta_tags):
)


@pytest.mark.sphinx("html", testroot="meta-name-description")
def test_meta_name_description(meta_tags):
og_description = get_tag_content(meta_tags, "description")
description = [tag for tag in meta_tags if tag.get("name") == "description"][0].get(
"content", ""
)

assert og_description == description


@pytest.mark.sphinx("html", testroot="simple")
def test_site_url(og_meta_tags):
# Uses the same directory as simple, because it already contains url for a minimal config
Expand Down

0 comments on commit be9a41d

Please sign in to comment.