|
16 | 16 |
|
17 | 17 | <!-- Setup Open Graph image -->
|
18 | 18 |
|
19 |
| - {% if page.image %} |
20 |
| - {% assign src = page.image.path | default: page.image %} |
| 19 | + {% if page.card_image %} |
| 20 | + {%- capture img_url -%} |
| 21 | + {% include img-url.html src=page.card_image absolute=true %} |
| 22 | + {%- endcapture -%} |
21 | 23 |
|
| 24 | + {%- capture og_image -%} |
| 25 | + <meta property="og:image" content="{{ img_url }}" /> |
| 26 | + {%- endcapture -%} |
| 27 | + |
| 28 | + {%- capture twitter_image -%} |
| 29 | + <meta name="twitter:card" content="summary_large_image" /> |
| 30 | + <meta property="twitter:image" content="{{ img_url }}" /> |
| 31 | + {%- endcapture -%} |
| 32 | + |
| 33 | + {% assign new_meta_clip = og_image | append: twitter_image %} |
| 34 | + {% assign seo_tags = seo_tags | replace: '<meta name="twitter:card" content="summary" />', new_meta_clip %} |
| 35 | + |
| 36 | + {% elsif page.image %} |
| 37 | + {% assign src = page.image.path | default: page.image %} |
22 | 38 | {% unless src contains '://' %}
|
23 |
| - {%- capture img_url -%} |
24 |
| - {% include img-url.html src=src img_path=page.img_path absolute=true %} |
25 |
| - {%- endcapture -%} |
| 39 | + {%- capture img_url -%} |
| 40 | + {% include img-url.html src=src img_path=page.img_path absolute=true %} |
| 41 | + {%- endcapture -%} |
26 | 42 |
|
27 |
| - {%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%} |
28 |
| - {%- capture new_url -%}{{ img_url }}{%- endcapture -%} |
| 43 | + {%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%} |
| 44 | + {%- capture new_url -%}{{ img_url }}{%- endcapture -%} |
29 | 45 |
|
30 |
| - {% assign seo_tags = seo_tags | replace: old_url, new_url %} |
| 46 | + {% assign seo_tags = seo_tags | replace: old_url, new_url %} |
31 | 47 | {% endunless %}
|
32 | 48 |
|
33 | 49 | {% elsif site.social_preview_image %}
|
34 | 50 | {%- capture img_url -%}
|
35 |
| - {% include img-url.html src=site.social_preview_image absolute=true %} |
| 51 | + {% include img-url.html src=site.social_preview_image absolute=true %} |
36 | 52 | {%- endcapture -%}
|
37 | 53 |
|
38 | 54 | {%- capture og_image -%}
|
39 |
| - <meta property="og:image" content="{{ img_url }}" /> |
| 55 | + <meta property="og:image" content="{{ img_url }}" /> |
40 | 56 | {%- endcapture -%}
|
41 | 57 |
|
42 | 58 | {%- capture twitter_image -%}
|
43 |
| - <meta name="twitter:card" content="summary_large_image" /> |
44 |
| - <meta property="twitter:image" content="{{ img_url }}" /> |
| 59 | + <meta name="twitter:card" content="summary_large_image" /> |
| 60 | + <meta property="twitter:image" content="{{ img_url }}" /> |
45 | 61 | {%- endcapture -%}
|
46 |
| - |
| 62 | + |
47 | 63 | {% assign old_meta_clip = '<meta name="twitter:card" content="summary" />' %}
|
48 | 64 | {% assign new_meta_clip = og_image | append: twitter_image %}
|
49 | 65 | {% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
|
50 | 66 | {% endif %}
|
51 | 67 |
|
52 |
| - {{ seo_tags }} |
| 68 | +{{ seo_tags }} |
53 | 69 |
|
54 | 70 | <title>
|
55 | 71 | {%- unless page.layout == 'home' -%}
|
|
0 commit comments