File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed
Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 2020
2121 {% unless src contains '://' %}
2222 {%- 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 %}
2424 {%- endcapture -%}
2525
2626 {%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%}
3131
3232 {% elsif site.social_preview_image %}
3333 {%- 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 %}
3535 {%- endcapture -%}
3636
3737 {%- capture og_image -%}
3838 < meta property ="og:image " content ="{{ img_url }} " />
3939 {%- endcapture -%}
4040
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 %}
4348 {% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
4449 {% endif %}
4550
8590 {% endif %}
8691
8792 <!-- 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 }} ">
8994
9095 <!-- Font Awesome -->
9196 < link rel ="stylesheet " href ="{{ site.data.origin[type].fontawesome.css | relative_url }} ">
Original file line number Diff line number Diff line change 22 Generate image final URL based on `site.img_cdn`, `page.img_path`
33
44 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
78
89 Return:
910 image URL
1415{%- if url -%}
1516 {% unless url contains ':' %}
1617 {%- comment -%} CND URL {%- endcomment -%}
17- {% assign prefix = site.img_cdn | default: '' | relative_url %}
18+ {% assign prefix = site.img_cdn | default: '' %}
1819
1920 {%- comment -%} Add page image path prefix {%- endcomment -%}
2021 {% assign url = include.img_path | default: '' | append: '/' | append: url %}
2627 | replace: '//', '/'
2728 | replace: ':', ':/'
2829 %}
30+
31+ {% if include.absolute %}
32+ {% assign url = url | absolute_url %}
33+ {% else %}
34+ {% assign url = url | relative_url %}
35+ {% endif %}
2936 {% endunless %}
3037{%- endif -%}
3138
You can’t perform that action at this time.
0 commit comments