Skip to content

Commit

Permalink
Link to posts from teaser image and include image on post page
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMitchL committed Dec 31, 2023
1 parent 7011ec0 commit 0db7b55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/_includes/layouts/post.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ type: post
</header>
<main id="maincontent">
<article itemscope itemtype="https://schema.org/BlogPosting">
{%- if image -%}
<div class="article-teaser">
<img itemprop="image" src="{{ image }}" alt="{{ imageAlt }}" />
</div>
{%- endif -%}
<hgroup>
<h1 itemprop="headline">{{ title }}</h1>
<p itemprop="subheading">{{ description }}</p>
<p>{{ description }}</p>
</hgroup>
<p class="flex-wrap-space-between">
<span>
Expand Down
1 change: 1 addition & 0 deletions src/assets/css/partials/components.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ a.tag {
ol.tags-list,
ul.tags-list {
display: inline-flex;
align-items: center;
padding-inline-start: 0.25em;
flex-wrap: wrap;
gap: 0.25rem;
Expand Down
10 changes: 6 additions & 4 deletions src/posts.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ eleventyNavigation:
---

{%- for post in posts -%}
<article>
<article itemscope itemtype="https://schema.org/BlogPosting">
{%- if post.data.image -%}
<div class="article-teaser">
<img src="{{ post.data.image }}" alt="{{ post.data.imageAlt }}" />
<a href="{{ post.url }}" aria-label="{{ post.data.title }}">
<img itemprop="image" src="{{ post.data.image }}" alt="{{ post.data.imageAlt }}" />
</a>
</div>
{%- endif -%}
<h2>
<a href="{{ post.url }}" class="link-heading">{{ post.data.title }}</a>
<h2 itemprop="headline">
<a href="{{ post.url }}" itemprop="url">{{ post.data.title }}</a>
</h2>
<div class="article-meta">
<time
Expand Down

0 comments on commit 0db7b55

Please sign in to comment.