Skip to content

Commit f8a6847

Browse files
committed
Fixed thumbnail choosing on blog posts
1 parent 97b6367 commit f8a6847

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

_includes/post_thumbnail_url.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
{%- assign image_parts = rendered_content | split: "<img" -%}
55
{%- for image_part in image_parts offset: 1 -%}
6+
{%- assign image_tag = image_part | split: ">" | first -%}
67
{%- assign candidate = "" -%}
7-
{%- if image_part contains 'src="' -%}
8-
{%- assign candidate = image_part | split: 'src="' | last | split: '"' | first | strip -%}
9-
{%- elsif image_part contains "src='" -%}
10-
{%- assign candidate = image_part | split: "src='" | last | split: "'" | first | strip -%}
8+
{%- if image_tag contains 'src="' -%}
9+
{%- assign candidate = image_tag | split: 'src="' | last | split: '"' | first | strip -%}
10+
{%- elsif image_tag contains "src='" -%}
11+
{%- assign candidate = image_tag | split: "src='" | last | split: "'" | first | strip -%}
1112
{%- endif -%}
1213

1314
{%- assign candidate_downcase = candidate | downcase -%}

images/posts/h1-2026/box2d

-1.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)