Skip to content

Commit fe3b3a6

Browse files
IamPhytanst1020
andauthored
feat: add optional cover image alt (#20)
Co-authored-by: st1020 <[email protected]>
1 parent 11028d7 commit fe3b3a6

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

content/markdown-syntax.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ description = "Sample article showcasing basic Markdown syntax and formatting fo
55
[taxonomies]
66
tags = ["markdown", "css", "html"]
77
[extra]
8-
cover_image = "images/markdown-syntax.png"
8+
cover.image = "images/markdown-syntax.png"
9+
cover.alt = "A Markdown logo"
910
+++
1011

1112
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.

templates/page.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ <h1 class="!my-0 pb-2.5">{{ page.title }}</h1>
66
{% include "partials/page_info.html" %}
77
</header>
88

9-
{% if page.extra.cover_image %}<!---->
9+
{% if page.extra.cover.image %}<!---->
1010
<figure class="mb-12 mt-0">
1111
<img
1212
class="h-auto w-full rounded-lg"
13-
src="{{ get_url(path=page.extra.cover_image) }}"
14-
alt="cover"
13+
src="{{ get_url(path=page.extra.cover.image) }}"
14+
alt="{{ page.extra.cover.alt | default(value='cover') }}"
1515
/>
1616
</figure>
1717
{% endif %}

templates/partials/head.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
<meta property="og:site_name" content="{{ config.title }}" />
3737
<meta property="og:description" content="{{ description }}" />
3838
<meta property="og:url" content="{{ page.permalink }}" />
39-
{% if page.extra.cover_image %}
39+
{% if page.extra.cover.image %}
4040
<!---->
41-
{% set image = page.extra.cover_image %}
41+
{% set image = page.extra.cover.image %}
4242
<!---->
4343
{% elif config.extra.social_image %}
4444
<!---->

templates/partials/page_list.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<section
1313
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"
1414
>
15-
{% if page.extra.cover_image %}
15+
{% if page.extra.cover.image %}
1616
<figure class="mb-4 mt-0">
1717
<img
1818
class="h-auto w-full rounded-lg"
19-
src="{{ get_url(path=page.extra.cover_image) }}"
20-
alt="cover"
19+
src="{{ get_url(path=page.extra.cover.image) }}"
20+
alt="{{ page.extra.cover.alt | default(value='cover') }}"
2121
/>
2222
</figure>
2323
{% endif %}<!---->

0 commit comments

Comments
 (0)