|
1 |
| -<!-- The Head --> |
2 |
| - |
3 | 1 | <head>
|
4 | 2 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5 | 3 | <meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
|
|
11 | 9 | content="width=device-width, user-scalable=no initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
|
12 | 10 | >
|
13 | 11 |
|
14 |
| - {% capture seo_tags %} |
| 12 | + {%- capture seo_tags -%} |
15 | 13 | {% seo title=false %}
|
16 |
| - {% endcapture %} |
| 14 | + {%- endcapture -%} |
| 15 | + |
| 16 | + <!-- Setup Open Graph image --> |
17 | 17 |
|
18 | 18 | {% if page.image %}
|
19 |
| - {% assign img = page.image.path | default: page.image %} |
20 |
| - |
21 |
| - {% unless img contains '://' %} |
22 |
| - {% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %} |
23 |
| - {% capture target %}"{{ img | absolute_url }}"{% endcapture %} |
24 |
| - |
25 |
| - {% if site.img_cdn contains '//' %} |
26 |
| - <!-- it's a cross-origin URL --> |
27 |
| - {% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% endcapture %} |
28 |
| - {% else %} |
29 |
| - <!-- it's a local file path --> |
30 |
| - {%- capture replacement -%} |
31 |
| - "{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}" |
32 |
| - {%- endcapture -%} |
33 |
| - {% endif %} |
34 |
| - |
35 |
| - {% assign seo_tags = seo_tags | replace: target, replacement %} |
| 19 | + {% assign src = page.image.path | default: page.image %} |
| 20 | + |
| 21 | + {% unless src contains '://' %} |
| 22 | + {%- capture img_url -%} |
| 23 | + {% include img-url.html src=src img_path=page.img_path %} |
| 24 | + {%- endcapture -%} |
| 25 | + |
| 26 | + {%- capture old_url -%}{{ src | absolute_url }}{%- endcapture -%} |
| 27 | + {%- capture new_url -%}{{ img_url }}{%- endcapture -%} |
| 28 | + |
| 29 | + {% assign seo_tags = seo_tags | replace: old_url, new_url %} |
36 | 30 | {% endunless %}
|
| 31 | + |
| 32 | + {% elsif site.social_preview_image %} |
| 33 | + {%- capture img_url -%} |
| 34 | + {% include img-url.html src=site.social_preview_image %} |
| 35 | + {%- endcapture -%} |
| 36 | + |
| 37 | + {%- capture og_image -%} |
| 38 | + <meta property="og:image" content="{{ img_url }}" /> |
| 39 | + {%- endcapture -%} |
| 40 | + |
| 41 | + {% assign old_meta_clip = '<meta name="twitter:card"' %} |
| 42 | + {% assign new_meta_clip = og_image | append: old_meta_clip %} |
| 43 | + {% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %} |
37 | 44 | {% endif %}
|
38 | 45 |
|
39 | 46 | {{ seo_tags }}
|
|
0 commit comments