Fix banner loading and processing

This commit is contained in:
daudix
2024-08-26 16:50:54 +03:00
parent 4392844fc6
commit 2f00256c0f
4 changed files with 4 additions and 8 deletions

View File

@ -247,7 +247,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add "open post" button to comments. - Add "open post" button to comments.
- Add external link icon to buttons that lead to external sites. - Add external link icon to buttons that lead to external sites.
- Add i18n support. - Add i18n support.
- Add language switcher menu in the navbar (enabled automatically if site is availabe in more than one language). - Add language switcher menu in the navbar (enabled automatically if site is available in more than one language).
- Allow adding per-page/section stylesheets via the `extra.stylesheets` variable. - Allow adding per-page/section stylesheets via the `extra.stylesheets` variable.
- Allow setting custom copyright text via the new `config.extra.footer.copyright` config variable. - Allow setting custom copyright text via the new `config.extra.footer.copyright` config variable.
- Button-like style for footer's "Powered by" links. - Button-like style for footer's "Powered by" links.

View File

@ -7,7 +7,7 @@ updated = "2024-06-21"
[taxonomies] [taxonomies]
tags = ["Demo", "Test"] tags = ["Demo", "Test"]
[extra] [extra]
banner = "blog/the-quill-of-duck/quill.png" banner = "quill.png"
toc = true toc = true
trigger = "This page contains blackjack and hookers, and bad jokes such as this one." trigger = "This page contains blackjack and hookers, and bad jokes such as this one."
disclaimer = """ disclaimer = """
@ -27,10 +27,6 @@ Recommended banner dimensions are 2:1 aspect ratio and 1920x960 resolution.
Other sizes will also work, but will be cut off at the bottom/won't be high enough. Other sizes will also work, but will be cut off at the bottom/won't be high enough.
{% end %} {% end %}
{% alert(note=true) %}
The path to the banner should be the same as the resulting path to the post, e.g. `blog/the-quill-of-duck/quill.png`. If the folder name has a timestamp, remove it. You can simply open the post in your browser and copy the path from the URL.
{% end %}
## The what? ## The what?
This is a Duckquill post example, this post has nothing but a bunch of text and random formatting, acting like a demo. This is a Duckquill post example, this post has nothing but a bunch of text and random formatting, acting like a demo.

View File

@ -7,7 +7,7 @@
<article> <article>
{%- if page.extra.banner -%} {%- if page.extra.banner -%}
<div id="banner-container"> <div id="banner-container">
<img id="banner" class="full-bleed{% if page.extra.banner_pixels %} pixels{% endif %}" src="{{ get_url(path=page.extra.banner, lang=lang)}}" {% if config.markdown.lazy_async_image %}decoding="async" loading="lazy"{% endif %} /> <img id="banner" class="full-bleed{% if page.extra.banner_pixels %} pixels{% endif %}" src="{{ current_url ~ page.extra.banner }}" {% if config.markdown.lazy_async_image %}decoding="async" loading="lazy"{% endif %} />
</div> </div>
{%- endif -%} {%- endif -%}

View File

@ -1,5 +1,5 @@
{%- if page.extra.banner -%} {%- if page.extra.banner -%}
{% set card = resize_image(path=page.extra.banner, width=1200, height=628, op="fill") %} {%- set card = resize_image(path=page.colocated_path ~ page.extra.banner, width=1200, height=628, op="fill") -%}
{{ card.url }} {{ card.url }}
{%- else -%} {%- else -%}
{{ get_url(path='card.png') }} {{ get_url(path='card.png') }}