Skip to content

Commit 853d65e

Browse files
committed
fix card_image front matter
1 parent 82dc2a5 commit 853d65e

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

_includes/head.html

+30-20
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,65 @@
1717
<!-- Setup Open Graph image -->
1818

1919
{% 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 %}
2332

2433
{%- capture og_image -%}
25-
<meta property="og:image" content="{{ img_url }}" />
34+
<meta property="og:image" content="{{ img_url }}" />
2635
{%- endcapture -%}
2736

2837
{%- 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 }}" />
3140
{%- endcapture -%}
3241

42+
{% assign old_meta_clip = '<meta name="twitter:card" content="summary" />' %}
3343
{% 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 %}
3645
{% elsif page.image %}
3746
{% assign src = page.image.path | default: page.image %}
47+
3848
{% 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 -%}
4252

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 -%}
4555

46-
{% assign seo_tags = seo_tags | replace: old_url, new_url %}
56+
{% assign seo_tags = seo_tags | replace: old_url, new_url %}
4757
{% endunless %}
4858

4959
{% elsif site.social_preview_image %}
5060
{%- 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 %}
5262
{%- endcapture -%}
5363

5464
{%- capture og_image -%}
55-
<meta property="og:image" content="{{ img_url }}" />
65+
<meta property="og:image" content="{{ img_url }}" />
5666
{%- endcapture -%}
5767

5868
{%- 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 }}" />
6171
{%- endcapture -%}
62-
72+
6373
{% assign old_meta_clip = '<meta name="twitter:card" content="summary" />' %}
6474
{% assign new_meta_clip = og_image | append: twitter_image %}
6575
{% assign seo_tags = seo_tags | replace: old_meta_clip, new_meta_clip %}
6676
{% endif %}
6777

68-
{{ seo_tags }}
78+
{{ seo_tags }}
6979

7080
<title>
7181
{%- unless page.layout == 'home' -%}

_posts/writeups/2024/2024-06-27-off-by-one-badge-2024.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ categories: [Writeups]
66
img_path: /assets/posts/2024-06-27-off-by-one-badge-2024/
77
tags: [hardware]
88
toc: True
9-
card_image: /assets/posts/2024-06-27-off-by-one-badge-2024/powerpuff_girls.jpg
9+
card_image: powerpuff_girls.jpg
1010
---
1111

1212
I attended the first ever Vulnerability Research based cybersecurity conference in Singapore -- [**Off By One**](https://offbyone.sg/) organized by __[Star Labs](https://starlabs.sg/), [Eugene Lim](https://spaceraccoon.dev) and [Sim Cher Boon](https://twitter.com/cherboon)__ -- and had an amazing time!

0 commit comments

Comments
 (0)