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