Skip to content

Commit 7c4af8a

Browse files
committed
Revert "fix: correct the Twitter Card in social share preview (cotes2020#1498)"
This reverts commit 74f1662.
1 parent abb235a commit 7c4af8a

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

_includes/head.html

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
{% unless src contains '://' %}
2222
{%- capture img_url -%}
23-
{% include img-url.html src=src img_path=page.img_path absolute=true %}
23+
{% include img-url.html src=src img_path=page.img_path %}
2424
{%- endcapture -%}
2525

2626
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
@@ -31,20 +31,15 @@
3131

3232
{% elsif site.social_preview_image %}
3333
{%- capture img_url -%}
34-
{% include img-url.html src=site.social_preview_image absolute=true %}
34+
{% include img-url.html src=site.social_preview_image %}
3535
{%- endcapture -%}
3636

3737
{%- capture og_image -%}
3838
<meta property="og:image" content="{{ img_url }}" />
3939
{%- endcapture -%}
4040

41-
{%- capture twitter_image -%}
42-
<meta property="twitter:card" content="summary_large_image" />
43-
<meta property="twitter:image" content="{{ img_url }}" />
44-
{%- endcapture -%}
45-
46-
{% assign old_meta_clip = '<meta name="twitter:card" content="summary" />' %}
47-
{% assign new_meta_clip = og_image | append: twitter_image %}
41+
{% assign old_meta_clip = '<meta name="twitter:card"' %}
42+
{% assign new_meta_clip = og_image | append: old_meta_clip %}
4843
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
4944
{% endif %}
5045

@@ -90,7 +85,7 @@
9085
{% endif %}
9186

9287
<!-- Bootstrap -->
93-
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url }}">
88+
<link rel="stylesheet" href="{{ site.data.origin[type].bootstrap.css | relative_url}}">
9489

9590
<!-- Font Awesome -->
9691
<link rel="stylesheet" href="{{ site.data.origin[type].fontawesome.css | relative_url }}">

_includes/img-url.html

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
Generate image final URL based on `site.img_cdn`, `page.img_path`
33

44
Arguments:
5-
src - required, basic image path
6-
img_path - optional, relative path of image
7-
absolute - optional, boolean, if true, generate absolute URL
5+
src - basic image path, required
6+
img_path - relative path of image, optional
87

98
Return:
109
image URL
@@ -15,7 +14,7 @@
1514
{%- if url -%}
1615
{% unless url contains ':' %}
1716
{%- comment -%} CND URL {%- endcomment -%}
18-
{% assign prefix = site.img_cdn | default: '' %}
17+
{% assign prefix = site.img_cdn | default: '' | relative_url %}
1918

2019
{%- comment -%} Add page image path prefix {%- endcomment -%}
2120
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
@@ -27,12 +26,6 @@
2726
| replace: '//', '/'
2827
| replace: ':', ':/'
2928
%}
30-
31-
{% if include.absolute %}
32-
{% assign url = url | absolute_url %}
33-
{% else %}
34-
{% assign url = url | relative_url %}
35-
{% endif %}
3629
{% endunless %}
3730
{%- endif -%}
3831

0 commit comments

Comments
 (0)