Skip to content

Commit a550d57

Browse files
committed
Add social cards support
1 parent cd91293 commit a550d57

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/_templates/layout.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,28 @@
1515

1616
{% if pagename == 'index' %}
1717
<link rel="canonical" href="https://docs.python-guide.org/"/>
18+
<meta property="og:url" content="https://docs.python-guide.org/">
1819
{% elif pagename == '404' %}
1920
{# No canonical on our 404 template. #}
2021
{% else %}
2122
<link rel="canonical" href="https://docs.python-guide.org/{{ pagename }}/"/>
23+
<meta property="og:url" content="https://docs.python-guide.org/{{ pagename }}">
2224
{% endif %}
2325

2426
<link rel="icon" type="image/png" href="https://media.readthedocs.org/images/favicon.png">
2527

2628
<meta name="google-site-verification" content="013PxE2_8KX9jdUSC5gr8QsfdxTXr1mFgmD9zplp5II" />
2729

30+
<meta name="twitter:card" content="summary">
31+
<meta property="twitter:image" content="https://docs.python-guide.org/_static/python-guide-logo.png">
32+
<meta property="og:image" content="https://docs.python-guide.org/_static/python-guide-logo.png">
33+
<meta property="og:title" content="{{ title }}{{ titlesuffix }}">
34+
<meta property="og:type" content="article">
35+
{%- if metatags is defined %}
36+
{# FIXME: For some reason the `meta` dict is always empty. Extract the desc from the `metatags` text. #}
37+
<meta property="og:description" content="{{ metatags[15:-24] }}">
38+
{%- endif %}
39+
2840
<script>window.rp_prop_id = '29182759436';</script>
2941
<script src="https://srv.realpython.net/tag.js" async></script>
3042

0 commit comments

Comments
 (0)