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
<linkrel="canonical" href="https://docs.python-guide.org/"/>
18+
<metaproperty="og:url" content="https://docs.python-guide.org/">
1819
{% elif pagename == '404' %}
1920
{# No canonical on our 404 template. #}
2021
{% else %}
2122
<linkrel="canonical" href="https://docs.python-guide.org/{{pagename }}/"/>
23+
<metaproperty="og:url" content="https://docs.python-guide.org/{{pagename }}">
2224
{% endif %}
2325

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

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

30+
<metaname="twitter:card" content="summary">
31+
<metaproperty="twitter:image" content="https://docs.python-guide.org/_static/python-guide-logo.png">
32+
<metaproperty="og:image" content="https://docs.python-guide.org/_static/python-guide-logo.png">
33+
<metaproperty="og:title" content="{{title }}{{titlesuffix }}">
34+
<metaproperty="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+
<metaproperty="og:description" content="{{metatags[15:-24] }}">
38+
{%- endif %}
39+
2840
<script>window.rp_prop_id='29182759436';</script>
2941
<scriptsrc="https://srv.realpython.net/tag.js" async></script>
3042

0 commit comments

Comments
(0)