File tree 2 files changed +20
-8
lines changed
2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 20
20
21
21
{% unless src contains '://' %}
22
22
{%- capture img_url -%}
23
- {% include img-url.html src=src img_path=page.img_path %}
23
+ {% include img-url.html src=src img_path=page.img_path absolute=true %}
24
24
{%- endcapture -%}
25
25
26
26
{%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
31
31
32
32
{% elsif site.social_preview_image %}
33
33
{%- capture img_url -%}
34
- {% include img-url.html src=site.social_preview_image %}
34
+ {% include img-url.html src=site.social_preview_image absolute=true %}
35
35
{%- endcapture -%}
36
36
37
37
{%- capture og_image -%}
38
38
< meta property ="og:image " content ="{{ img_url }} " />
39
39
{%- endcapture -%}
40
40
41
- {% assign old_meta_clip = '< meta name ="twitter:card "' %}
42
- {% assign new_meta_clip = og_image | append: old_meta_clip %}
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 %}
43
48
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
44
49
{% endif %}
45
50
85
90
{% endif %}
86
91
87
92
<!-- Bootstrap -->
88
- < link rel ="stylesheet " href ="{{ site.data.origin[type].bootstrap.css | relative_url}} ">
93
+ < link rel ="stylesheet " href ="{{ site.data.origin[type].bootstrap.css | relative_url }} ">
89
94
90
95
<!-- Font Awesome -->
91
96
< link rel ="stylesheet " href ="{{ site.data.origin[type].fontawesome.css | relative_url }} ">
Original file line number Diff line number Diff line change 2
2
Generate image final URL based on `site.img_cdn`, `page.img_path`
3
3
4
4
Arguments:
5
- src - basic image path, required
6
- img_path - relative path of image, optional
5
+ src - required, basic image path
6
+ img_path - optional, relative path of image
7
+ absolute - optional, boolean, if true, generate absolute URL
7
8
8
9
Return:
9
10
image URL
14
15
{%- if url -%}
15
16
{% unless url contains ':' %}
16
17
{%- comment -%} CND URL {%- endcomment -%}
17
- {% assign prefix = site.img_cdn | default: '' | relative_url %}
18
+ {% assign prefix = site.img_cdn | default: '' %}
18
19
19
20
{%- comment -%} Add page image path prefix {%- endcomment -%}
20
21
{% assign url = include.img_path | default: '' | append: '/' | append: url %}
26
27
| replace: '//', '/'
27
28
| replace: ':', ':/'
28
29
%}
30
+
31
+ {% if include.absolute %}
32
+ {% assign url = url | absolute_url %}
33
+ {% else %}
34
+ {% assign url = url | relative_url %}
35
+ {% endif %}
29
36
{% endunless %}
30
37
{%- endif -%}
31
38
You can’t perform that action at this time.
0 commit comments