Add support for preview images #2

This commit is contained in:
david-swift 2025-03-11 14:22:03 +01:00
parent 6e2fc7da5c
commit c242520c60
10 changed files with 36 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

View File

@ -4,6 +4,8 @@ title = "Blogs"
description = "Duckling offers the blogs feature borrowed from Duckquill 🦆"
[taxonomies]
tags = ["Demo", "Test"]
[extra]
preview = "duckling.jpg"
+++
Check out the [sample blog](/blog) to see the blogging feature in action!

View File

@ -5,7 +5,7 @@ description = "No need for a separate documentation page - coming soon!"
[taxonomies]
tags = ["Demo", "Test"]
[extra]
featured = true
preview = "pond.jpg"
+++
This feature is not yet implemented. Coming soon!

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

View File

@ -4,6 +4,8 @@ title = "Subprojects"
description = "Showcase parts of your project!"
[taxonomies]
tags = ["Demo", "Test"]
[extra]
preview = "duckling.jpg"
+++
I'm an example for a subproject!

View File

@ -2,6 +2,12 @@
flex-direction: column;
}
#article-list {
article {
padding: 1.5rem;
}
}
#article-list, #subproject-list {
display: flex;
gap: 1rem;
@ -11,11 +17,10 @@
--bg-overlay: var(--accent-color-alpha);
position: relative;
transition: var(--transition);
border-radius: var(--rounded-corner);
background-position: center;
background-size: cover;
background-color: var(--fg-contrast-soft);
padding: 1.5rem;
border-radius: var(--rounded-corner);
overflow: hidden;
&:hover {

View File

@ -103,7 +103,7 @@ video {
}
}
img {
img:not(.preview) {
transition: var(--transition-longer);
&:not(

View File

@ -6,6 +6,19 @@
width: calc(50% - 0.5rem);
min-width: 300px;
flex-grow: 1;
img {
margin: 0;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
box-shadow: none;
object-fit: cover;
height: 200px;
width: 100%;
}
#subproject-info {
padding: 1.5rem;
}
}
}

View File

@ -24,10 +24,15 @@
{{- article_string -}}
</span>
{%- endif %}
<h3>{{ page.title }}</h3>
{%- if page.description %}
{{ page.description | markdown | safe }}
{%- endif %}
{%- if page.extra.preview -%}
<img class="preview" src="{{ current_url ~ page.slug ~ "/" ~ page.extra.preview }}" {% if config.markdown.lazy_async_image %}decoding="async" loading="lazy"{% endif %} />
{%- endif -%}
<div id="subproject-info">
<h3>{{ page.title }}</h3>
{%- if page.description %}
{{ page.description | markdown | safe }}
{%- endif %}
</div>
</article>
{%- endfor %}
</div>