Skip to content

Commit 109c443

Browse files
committed
update featured_image
1 parent c4d5d8c commit 109c443

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

_includes/featured_image.html

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
{%- if page.image %}
2-
<figure class="wp-block-post-featured-image">
3-
<figure class="wp-caption featured">
4-
<img
5-
src="{{ page.image | prepend: '/assets/images/' | relative_url }}"
6-
class="attachment-post-thumbnail size-post-thumbnail wp-post-image"
7-
alt=""
8-
style="object-fit:cover;"
9-
decoding="async"
10-
fetchpriority="high"/>
11-
{%- if page.image_caption %}
12-
<figcaption style="font-size: var(--wp--preset--font-size--x-small); text-align: right; margin-top: -25px; padding-right: 5px; color: white;">{{ page.image_caption }}</figcaption>
13-
{%- endif %}
14-
</figure>
2+
<figure class="featured-image">
3+
<img
4+
src="{{ page.image | prepend: '/assets/images/' | relative_url }}" alt="Featured image for post '{{ page.title | escape }}'"
5+
decoding="async"
6+
fetchpriority="high"/>
7+
{%- if page.image_caption %}
8+
<figcaption class="overlay-caption">{{ page.image_caption }}</figcaption>
9+
{%- endif %}
1510
</figure>
1611
{%- endif %}

_sass/structure.scss

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,23 @@ body {
160160
margin-bottom: 1em;
161161
margin-top: 0.5em;
162162
}
163+
164+
figcaption.overlay-caption {
165+
font-size: var(--wp--preset--font-size--x-small);
166+
text-align: right;
167+
margin-top: -2em;
168+
margin-bottom: 0;
169+
padding-right: 1em;
170+
color: white;
171+
}
172+
}
173+
174+
.featured-image {
175+
@extend .document-figure;
176+
177+
img {
178+
object-fit: cover;
179+
}
163180
}
164181

165182
/* overrides for content types */
@@ -170,4 +187,4 @@ body {
170187

171188
.page {
172189
@extend .page-like;
173-
}
190+
}

0 commit comments

Comments
 (0)