Skip to content

Commit

Permalink
feat: add new parameter for posts to add feature image alt (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean1572 authored Sep 24, 2024
1 parent 2fde3be commit 6ff56f0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions _layouts/archive.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ <h3 class="archive-post-title archive-post-link">{{ post.title }}</h3>
<img
src="{{ post.featuredImage | string | crop: '3:2+0+0,Center' | resize: '300x200' | format: 'webp' | absolute_url }}"
class="inline_image archive-image"
alt="{{ post.featuredImageAlt | default: 'featured image' }}"
>
{% else %}
<img
src="{{ 'e4e_website-no-e4e.png' | crop: '3:2+0+0,Center' | resize: '300x200' | format: 'webp' | absolute_url }}"
class="inline_image archive-image"
alt="E4E Logo, post has no featured image"
>
{% endif %}

Expand Down
10 changes: 9 additions & 1 deletion _layouts/blog-post.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ <h1 class="post-title p-name" itemprop="name headline">{{ page.title | escape }}
</header>

<div class="featured-post-image">
<img alt="featured-image" width="816" height="auto" src="{{ page.featuredImage | relative_url }}" class="attachment-post-thumbnail size-post-thumbnail wp-post-thumbnail" sizes="(max-width: 816px) 100vw, 816px" >
<!-- we do allow for no images to be shown, could lead to bugs here... -->
<img
alt="{{ page.featuredImageAlt | default: 'featured image' }}"
width="816"
height="auto"
src="{{ page.featuredImage | relative_url }}"
class="attachment-post-thumbnail size-post-thumbnail wp-post-thumbnail"
sizes="(max-width: 816px) 100vw, 816px" >

</div>

<div class="post-content e-content" itemprop="articleBody">
Expand Down
6 changes: 4 additions & 2 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ <h2 class="home_header">SPONSER OUR RESERACH</h2>
{%- if post.featuredImage -%}
<img
src="{{ post.featuredImage | string | crop: '3:2+0+0,Center' | resize: '300x200!' | format: 'webp' | absolute_url }}"
>
alt="{{ post.featuredImageAlt | default: 'featured image' }}"
>
{% else %}
<img
src="{{ 'e4e_website-no-e4e.png' | crop: '3:2+0+0,Center' | resize: '300x200' | format: 'webp' | absolute_url }}"
>
alt="E4E Logo, post has no featured image"
>
{% endif %}
</div>

Expand Down
1 change: 1 addition & 0 deletions _posts/2013-04-01-test-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
date: 2013-04-01 05:36:54+00:00
description: null
featuredImage: /assets/2013-04-01-test-post_E4ELogo.gif
featuredImageAlt: Logo of E4E and test for alt system!
layout: blog-post
slug: /test-post
title: New Website!
Expand Down

0 comments on commit 6ff56f0

Please sign in to comment.