feat: add optional cover image alt (#20)

Co-authored-by: st1020 <me@st1020.com>
This commit is contained in:
Damien LaRocque 2024-10-03 22:26:19 -04:00 committed by GitHub
parent 11028d729f
commit fe3b3a6e14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 9 deletions

View file

@ -5,7 +5,8 @@ description = "Sample article showcasing basic Markdown syntax and formatting fo
[taxonomies] [taxonomies]
tags = ["markdown", "css", "html"] tags = ["markdown", "css", "html"]
[extra] [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. 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.

View file

@ -6,12 +6,12 @@
{% include "partials/page_info.html" %} {% include "partials/page_info.html" %}
</header> </header>
{% if page.extra.cover_image %}<!----> {% if page.extra.cover.image %}<!---->
<figure class="mb-12 mt-0"> <figure class="mb-12 mt-0">
<img <img
class="h-auto w-full rounded-lg" class="h-auto w-full rounded-lg"
src="{{ get_url(path=page.extra.cover_image) }}" src="{{ get_url(path=page.extra.cover.image) }}"
alt="cover" alt="{{ page.extra.cover.alt | default(value='cover') }}"
/> />
</figure> </figure>
{% endif %} {% endif %}

View file

@ -36,9 +36,9 @@
<meta property="og:site_name" content="{{ config.title }}" /> <meta property="og:site_name" content="{{ config.title }}" />
<meta property="og:description" content="{{ description }}" /> <meta property="og:description" content="{{ description }}" />
<meta property="og:url" content="{{ page.permalink }}" /> <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 %} {% elif config.extra.social_image %}
<!----> <!---->

View file

@ -12,12 +12,12 @@
<section <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" 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"> <figure class="mb-4 mt-0">
<img <img
class="h-auto w-full rounded-lg" class="h-auto w-full rounded-lg"
src="{{ get_url(path=page.extra.cover_image) }}" src="{{ get_url(path=page.extra.cover.image) }}"
alt="cover" alt="{{ page.extra.cover.alt | default(value='cover') }}"
/> />
</figure> </figure>
{% endif %}<!----> {% endif %}<!---->