Skip to content

Commit

Permalink
feat: add optional cover image alt (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: st1020 <[email protected]>
  • Loading branch information
IamPhytan and st1020 authored Oct 4, 2024
1 parent 11028d7 commit fe3b3a6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion content/markdown-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ description = "Sample article showcasing basic Markdown syntax and formatting fo
[taxonomies]
tags = ["markdown", "css", "html"]
[extra]
cover_image = "images/markdown-syntax.png"
cover.image = "images/markdown-syntax.png"
cover.alt = "A Markdown logo"
+++

This article offers a sample of basic Markdown syntax that can be used in Zola content files, also it shows whether basic HTML elements are decorated with CSS in a Kita theme.
Expand Down
6 changes: 3 additions & 3 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ <h1 class="!my-0 pb-2.5">{{ page.title }}</h1>
{% include "partials/page_info.html" %}
</header>

{% if page.extra.cover_image %}<!---->
{% if page.extra.cover.image %}<!---->
<figure class="mb-12 mt-0">
<img
class="h-auto w-full rounded-lg"
src="{{ get_url(path=page.extra.cover_image) }}"
alt="cover"
src="{{ get_url(path=page.extra.cover.image) }}"
alt="{{ page.extra.cover.alt | default(value='cover') }}"
/>
</figure>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions templates/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
<meta property="og:site_name" content="{{ config.title }}" />
<meta property="og:description" content="{{ description }}" />
<meta property="og:url" content="{{ page.permalink }}" />
{% if page.extra.cover_image %}
{% if page.extra.cover.image %}
<!---->
{% set image = page.extra.cover_image %}
{% set image = page.extra.cover.image %}
<!---->
{% elif config.extra.social_image %}
<!---->
Expand Down
6 changes: 3 additions & 3 deletions templates/partials/page_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<section
class="block-bg relative mb-4 rounded-lg p-4 first-of-type:mt-0 last-of-type:mb-0 active:scale-95 lg:mb-6 lg:p-6"
>
{% if page.extra.cover_image %}
{% if page.extra.cover.image %}
<figure class="mb-4 mt-0">
<img
class="h-auto w-full rounded-lg"
src="{{ get_url(path=page.extra.cover_image) }}"
alt="cover"
src="{{ get_url(path=page.extra.cover.image) }}"
alt="{{ page.extra.cover.alt | default(value='cover') }}"
/>
</figure>
{% endif %}<!---->
Expand Down

0 comments on commit fe3b3a6

Please sign in to comment.