Skip to content

Commit 23322c2

Browse files
authored
Add support for Twitter's 'summary_large_image' (daattali#668)
1 parent 45ef2fc commit 23322c2

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Add social network link: Mastodon (#646)
55
- Add support for sharing pages on new social network: VK (#657)
66
- Use Open Graph type 'article' for blog posts (#669)
7+
- Use Twitter's `summary_large_image` card when `share-img` is specified (#668)
78

89
## v3.0.0 2020-05-07
910

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Parameter | Description
141141
readtime | If you want a post to show how many minutes it will take to read it, use `readtime: true`.
142142
show-avatar | If you have an avatar configured in the `_config.yml` but you want to turn it off on a specific page, use `show-avatar: false`.
143143
image | If you want to add an image to your blog post that will show up next to the post's excerpt on the feed and in the post page itself, use `image: /path/to/img`.
144-
share-img | If you want to specify an image to use when sharing the page on Facebook or Twitter, then provide the image's full URL here.
144+
share-img | If you want to specify an image to use when sharing the page on Facebook or Twitter, then provide the image's path or full URL here.
145145
social-share | By default, every blog post has buttons to share the page on social media. If you want to turn this feature off, use `social-share: false`.
146146
nav-short | By default, the navigation bar gets shorter after scrolling down the page. If you want the navigation bar to always be short on a certain page, use `nav-short: true`
147147
gh-repo   | If you want to show GitHub buttons at the top of a post, this sets the GitHub repo name (eg. `daattali/beautiful-jekyll`). You must also use the `gh-badge` parameter to specify what buttons to show.

_includes/head.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,18 @@
8181
{% endif %}
8282

8383
{% if page.share-img %}
84-
<meta property="og:image" content="{{ page.share-img }}">
84+
<meta property="og:image" content="{{ page.share-img | absolute_url }}">
8585
{% elsif site.avatar %}
8686
<meta property="og:image" content="{{ site.avatar | absolute_url }}">
8787
{% endif %}
8888

8989

9090
<!-- Twitter summary cards -->
91+
{% if page.share-img %}
92+
<meta name="twitter:card" content="summary_large_image">
93+
{% else %}
9194
<meta name="twitter:card" content="summary">
95+
{% endif %}
9296
<meta name="twitter:site" content="@{{ site.social-network-links.twitter }}">
9397
<meta name="twitter:creator" content="@{{ site.social-network-links.twitter }}">
9498

@@ -109,7 +113,7 @@
109113
{% endif %}
110114

111115
{% if page.share-img %}
112-
<meta name="twitter:image" content="{{ page.share-img }}">
116+
<meta name="twitter:image" content="{{ page.share-img | absolute_url }}">
113117
{% elsif site.avatar %}
114118
<meta name="twitter:image" content="{{ site.avatar | absolute_url }}">
115119
{% endif %}

_posts/2020-02-26-flake-it-till-you-make-it.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ layout: post
33
title: Flake it till you make it
44
subtitle: Excerpt from Soulshaping by Jeff Brown
55
cover-img: /assets/img/path.jpg
6+
share-img: /assets/img/path.jpg
67
tags: [books, test]
78
---
89

0 commit comments

Comments
 (0)