Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 34 additions & 32 deletions blocks/_blog-post-featured-image.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,41 @@
assign image = closest.article.image
%}

<div
class="blog-post-featured-image blog-post-featured-image--{{ block.id }} blog-post-featured-image--height-{{ block_settings.height }} spacing-style size-style"
style="
--ratio: {% case block_settings.image_ratio %}
{% when 'landscape' %}16 / 9
{% when 'portrait' %}4 / 5
{% when 'adapt' %}{{ image.aspect_ratio | default: 1 }}
{% else %}1
{% endcase %};
{% render 'size-style', settings: block_settings %}
{% render 'spacing-style', settings: block_settings %}
"
{{ block.shopify_attributes }}
>
{%- capture image_border_style -%}
{% render 'border-override', settings: block_settings %}
{%- endcapture -%}
{% if image != blank %}
<div
class="blog-post-featured-image blog-post-featured-image--{{ block.id }} blog-post-featured-image--height-{{ block_settings.height }} spacing-style size-style"
style="
--ratio: {% case block_settings.image_ratio %}
{% when 'landscape' %}16 / 9
{% when 'portrait' %}4 / 5
{% when 'adapt' %}{{ image.aspect_ratio | default: 1 }}
{% else %}1
{% endcase %};
{% render 'size-style', settings: block_settings %}
{% render 'spacing-style', settings: block_settings %}
"
{{ block.shopify_attributes }}
>
{%- capture image_border_style -%}
{% render 'border-override', settings: block_settings %}
{%- endcapture -%}

{{
image
| image_url: width: 3840
| image_tag:
width: image.width,
widths: '240, 352, 832, 1200, 1600, 1920, 2560, 3840',
height: image.height,
class: 'blog-post-featured-image__image border-style',
style: image_border_style,
sizes: 'auto, (min-width: 750px) 100vw, 100vw',
loading: 'eager',
fetchpriority: 'high',
alt: image.alt
}}
</div>
{{
image
| image_url: width: 3840
| image_tag:
width: image.width,
widths: '240, 352, 832, 1200, 1600, 1920, 2560, 3840',
height: image.height,
class: 'blog-post-featured-image__image border-style',
style: image_border_style,
sizes: 'auto, (min-width: 750px) 100vw, 100vw',
loading: 'eager',
fetchpriority: 'high',
alt: image.alt
}}
</div>
{% endif %}

{% stylesheet %}
.blog-post-featured-image {
Expand Down
20 changes: 9 additions & 11 deletions sections/main-blog-post.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@
{% render 'spacing-style', settings: section.settings %}
"
>
<header>
{%- content_for 'block', id: 'blog-post-title', type: 'text' %}
{%- content_for 'block', id: 'blog-post-details', type: '_blog-post-info-text' %}
</header>

{%- if article.image -%}
{%- content_for 'block', id: 'blog-post-image', type: '_blog-post-featured-image' %}
{%- endif -%}
{%- content_for 'block', id: 'blog-post-content', type: '_blog-post-content' %}

{% comment %} Dynamic area for @app blocks only, at the bottom {% endcomment %}
{% content_for 'blocks' %}

{% if blog.comments_enabled? %}
Expand Down Expand Up @@ -119,6 +108,15 @@
},
{
"type": "@app"
},
{
"type": "_blog-post-info-text"
},
{
"type": "_blog-post-featured-image"
},
{
"type": "_blog-post-content"
}
],
"class": "section-wrapper",
Expand Down
10 changes: 6 additions & 4 deletions templates/article.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"blog-post-title": {
"type": "text",
"name": "Title",
"static": true,
"settings": {
"text": "<h1>{{ article.title }}</h1>",
"width": "100%",
Expand All @@ -42,7 +41,6 @@
"blog-post-details": {
"type": "_blog-post-info-text",
"name": "Details",
"static": true,
"settings": {
"show_date": true,
"show_author": false,
Expand All @@ -57,7 +55,6 @@
"blog-post-image": {
"type": "_blog-post-featured-image",
"name": "Featured image",
"static": true,
"settings": {
"image_ratio": "landscape",
"width": "fill",
Expand All @@ -78,11 +75,16 @@
},
"blog-post-content": {
"type": "_blog-post-content",
"static": true,
"settings": {},
"blocks": {}
}
},
"block_order": [
"blog-post-title",
"blog-post-details",
"blog-post-image",
"blog-post-content"
],
"settings": {
"content_direction": "column",
"gap": 32,
Expand Down