diff --git a/CHANGELOG.md b/CHANGELOG.md index cd3f293..2efe9c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. +## [1.1] + +- Set zola minimum version to 0.17 +- Updated responsive images to use the new `page.colocated_path` +- Hooks names updated for consistency +- Added class parameter for responsive images +- Added `images::image()` macro and `image_original` shortcode for images that don't want resizing (eg: animated gifs) + ## [1.0] - Packaged the theme based on the work of mr-karan and hugo-ink diff --git a/sass/blog.scss b/sass/blog.scss index 582e14e..0214444 100644 --- a/sass/blog.scss +++ b/sass/blog.scss @@ -10,8 +10,14 @@ img { // max-width: 800px; max-height: 90vh; - border-radius: var(--border-radius); + + &.small { + + max-height: none; + width: 100%; + max-width: 500px; + } } } } @@ -99,6 +105,7 @@ padding: 0; margin: 1rem 0; + li { display: inline-block; diff --git a/screenshot.png b/screenshot.png index d551c3a..367b715 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/templates/base.html b/templates/base.html index da7a5f5..f9b2839 100644 --- a/templates/base.html +++ b/templates/base.html @@ -38,7 +38,7 @@ {% if config.extra.avatar %}
- {{ images::responsive_image(path="", src=config.extra.avatar, default_size=128, sizes=[64,128,256,512], alt=config.title ) }} + {{ images::responsive_image(path="", src=config.extra.avatar, default_size=128, sizes=[64,128,256], alt=config.title ) }}
{% endif %} diff --git a/templates/gallery.html b/templates/gallery.html index 666acee..b2f2fad 100644 --- a/templates/gallery.html +++ b/templates/gallery.html @@ -13,7 +13,7 @@ {# { set image = resize_image(path=post.path ~ image, width=256, height=256, format=config.extra.image_format, quality=config.extra.thumbnail_quality) %} #}
  • - {{ images::responsive_thumbnail(path="", src=post.path ~ image, default_size=128, sizes=[128,256], alt=post.title ~ " - " ~ post.date ) }} + {{ images::responsive_thumbnail(path=post.colocated_path, src=image, default_size=128, sizes=[128,256], alt=post.title ~ " - " ~ post.date ) }}
  • diff --git a/templates/macros/hooks.html b/templates/macros/hooks.html index 8cc6a4b..7c551e5 100644 --- a/templates/macros/hooks.html +++ b/templates/macros/hooks.html @@ -1,6 +1,10 @@ {% extends "base.html" %} {# Page hooks #} -{% macro above_page(page) %}{% endmacro above_page %} -{% macro below_page(page) %}{% endmacro below_page %} -{% macro below_tags(page) %}{% endmacro below_tags %} \ No newline at end of file +{% macro post_above_content(page) %}{% endmacro above_page %} +{% macro post_below_content(page) %}{% endmacro below_page %} +{% macro post_below_tags(page) %}{% endmacro below_tags %} + +{% macro posts_below_title(page) %} + {{page.description}} +{% endmacro posts_below_title %} \ No newline at end of file diff --git a/templates/macros/images.html b/templates/macros/images.html index 25e1f08..d8280d4 100644 --- a/templates/macros/images.html +++ b/templates/macros/images.html @@ -1,15 +1,20 @@ {% extends "base.html" %} + +{% macro image(path, src, alt, class="") %} +{{ alt }} +{% endmacro image %} + {# Original author: crepererum https://github.com/getzola/even/pull/48/files Adapted to Inky template by jimmyff #} -{% macro responsive_image(path, src, alt, default_size, sizes) %} +{% macro responsive_image(path, src, alt, default_size, sizes, class="") %} {% if config.extra.image_resizing_disabled and config.extra.image_resizing_disabled == true %} -{{ alt }} +{{ image(path=path, src=src, alt=alt, class=class) }} {% else %} - {% set abspath = "./" ~ path ~ src %} + {% set abspath = path ~ src %} {% set meta = get_image_metadata(path=abspath) %} {% set width = meta.width %} {% set srcset_list = [] %} @@ -21,16 +26,16 @@ {% endif %} {% endfor %} {% set default_resized = resize_image(format=config.extra.image_format, path=abspath, width=default_size, op="fit_width", quality=config.extra.image_quality) %} - {{ alt }} + {{ alt }} {% endif %} {% endmacro responsive_image %} -{% macro responsive_thumbnail(path, src, alt, default_size, sizes) %} +{% macro responsive_thumbnail(path, src, alt, default_size, sizes, class="") %} {% if config.extra.image_resizing_disabled and config.extra.image_resizing_disabled == true %} - {{ alt }} +{{ image(path=path, src=src, alt=alt, class=class) }} {% else %} - {% set abspath = "./" ~ path ~ src %} + {% set abspath = path ~ src %} {% set meta = get_image_metadata(path=abspath) %} {% set width = meta.width %} {% set srcset_list = [] %} @@ -42,6 +47,6 @@ {% endif %} {% endfor %} {% set default_resized = resize_image(format=config.extra.image_format, path=abspath, width=default_size, height=default_size, op="fill", quality=config.extra.thumbnail_quality) %} - {{ alt }} + {{ alt }} {% endif %} {% endmacro responsive_thumbnail %} \ No newline at end of file diff --git a/templates/post.html b/templates/post.html index bede261..a5c7d49 100644 --- a/templates/post.html +++ b/templates/post.html @@ -15,11 +15,11 @@

    {{ page.title }} {% if page.draft %}Draft{% endif %}

    - {{ hooks::above_page(page=page) }} + {{ hooks::post_above_content(page=page) }}
    {{ page.content | safe }}
    - {{ hooks::below_page(page=page) }} + {{ hooks::post_below_content(page=page) }} {% if page.taxonomies is containing ("tags") %} {% endif %} - {{ hooks::below_tags(page=page) }} + {{ hooks::post_below_tags(page=page) }} {% endblock content %} diff --git a/templates/posts.html b/templates/posts.html index 00c7ada..e70903f 100644 --- a/templates/posts.html +++ b/templates/posts.html @@ -16,11 +16,11 @@
    -

    +
    {{ post.title }} {% if post.draft %}Draft{% endif %} -

    - {{post.description}} +
    + {{ hooks::posts_below_title(page=post) }} diff --git a/templates/shortcodes/image.html b/templates/shortcodes/image.html index ca21028..16ed7dc 100644 --- a/templates/shortcodes/image.html +++ b/templates/shortcodes/image.html @@ -1,5 +1,3 @@ {% import "macros/images.html" as images -%} - -{{ images::responsive_image(path=page.path, src=src, default_size=config.extra.images_default_size, sizes=config.extra.images_sizes, alt=alt ) }} - +{{ images::responsive_image(path=page.colocated_path, src=src, default_size=config.extra.images_default_size, sizes=config.extra.images_sizes, alt=alt, class=class | default(value="") ) }} diff --git a/templates/shortcodes/image_original.html b/templates/shortcodes/image_original.html new file mode 100644 index 0000000..f272c01 --- /dev/null +++ b/templates/shortcodes/image_original.html @@ -0,0 +1,3 @@ + +{% import "macros/images.html" as images -%} +{{ images::image(path=page.path, src=src, alt=alt, class=class | default(value="") ) }} diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html index d2e3ea2..47aaf52 100644 --- a/templates/taxonomy_single.html +++ b/templates/taxonomy_single.html @@ -16,11 +16,11 @@
    -

    +
    {{ post.title }} {% if post.draft %}Draft{% endif %} -

    - {{post.description}} +
    + {{ hooks::posts_below_title(page=post) }} diff --git a/theme.toml b/theme.toml index fee17c9..50c02ae 100644 --- a/theme.toml +++ b/theme.toml @@ -3,7 +3,7 @@ description = "An elegant and understated theme for Zola" license = "MIT" homepage = "https://github.com/jimmyff/zola-inky" # The minimum version of Zola required -min_version = "0.4.0" +min_version = "0.17.0" # An optional live demo URL demo = "https://jimmyff.github.io/zola-inky/"