Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new parameter for posts to add feature image alt #187

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Empty file added _includes/img_extension.html
Sean1572 marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
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
Loading