File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ def get_tags(
69
69
# type tag
70
70
tags ["og:type" ] = config ["ogp_type" ]
71
71
72
- if os .getenv ("READTHEDOCS" ) and config ["ogp_site_url" ] is None :
72
+ if os .getenv ("READTHEDOCS" ) and not config ["ogp_site_url" ]:
73
73
# readthedocs uses html_baseurl for sphinx > 1.8
74
74
parse_result = urlparse (config ["html_baseurl" ])
75
75
@@ -193,7 +193,9 @@ def html_page_context(
193
193
194
194
195
195
def setup (app : Sphinx ) -> Dict [str , Any ]:
196
- app .add_config_value ("ogp_site_url" , None , "html" )
196
+ # ogp_site_url="" allows relative by default, even though it's not
197
+ # officially supported by OGP.
198
+ app .add_config_value ("ogp_site_url" , "" , "html" )
197
199
app .add_config_value ("ogp_description_length" , DEFAULT_DESCRIPTION_LENGTH , "html" )
198
200
app .add_config_value ("ogp_image" , None , "html" )
199
201
app .add_config_value ("ogp_image_alt" , None , "html" )
Original file line number Diff line number Diff line change @@ -279,3 +279,15 @@ def test_rtd_invalid(app: Sphinx, monkeypatch):
279
279
280
280
with pytest .raises (Exception ):
281
281
app .build ()
282
+
283
+
284
+ # Test no breakage with no configuration
285
+ @pytest .mark .sphinx ("html" , testroot = "rtd-default" )
286
+ def test_no_configuration_html (og_meta_tags ):
287
+ assert get_tag_content (og_meta_tags , "type" ) == "website"
288
+
289
+
290
+ # Test no breakage with no configuration
291
+ @pytest .mark .sphinx ("dirhtml" , testroot = "rtd-default" )
292
+ def test_no_configuration_dirhtml (og_meta_tags ):
293
+ assert get_tag_content (og_meta_tags , "type" ) == "website"
You can’t perform that action at this time.
0 commit comments