Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add option to use og:description as description" #73

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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