Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a5b70ca

Browse files
authored
add support for twitter cards
1 parent 730be75 commit a5b70ca

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

_includes/head.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,21 @@
6363
<meta property="og:url" content="{{ site.url }}{{ page.url | remove: '/index.html' | remove: '.html' }}" />
6464
{% endif %}
6565

66-
{% if page.fb-img %}
67-
<meta property="og:image" content="{{ page.fb-img }}" />
66+
{% if page.share-img %}
67+
<meta property="og:image" content="{{ page.share-img }}" />
6868
{% else %}
6969
<meta property="og:image" content="{{ site.url }}{{ site.avatar }}" />
7070
{% endif %}
71+
72+
<!-- Twitter summary cards -->
73+
<meta name="twitter:card" content="summary" />
74+
<meta name="twitter:site" content="@{{ site.author.twitter }}" />
75+
<meta name="twitter:creator" content="@{{ site.author.twitter }}" />
76+
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}" />
77+
<meta name="twitter:description" content="{{ page.content | strip_html | xml_escape | truncatewords: 50 }}" />
78+
{% if page.share-img %}
79+
<meta name="twitter:image" content="{{ page.share-img }}" />
80+
{% elsif site.avatar %}
81+
<meta name="twitter:image" content="{{ site.url }}{{ site.avatar }}" />
82+
{% endif %}
7183
</head>

0 commit comments

Comments
 (0)