From 4f3e58d1c287c02f11b75c30e910fcb8193a78fa Mon Sep 17 00:00:00 2001 From: Brooke <12855764+goingforbrooke@users.noreply.github.com> Date: Fri, 16 Jun 2023 13:32:17 -0700 Subject: [PATCH] Use `resize_image` built-in fx to make image URLs --- templates/shortcodes/image.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/shortcodes/image.html b/templates/shortcodes/image.html index 7a2f044..a357b81 100644 --- a/templates/shortcodes/image.html +++ b/templates/shortcodes/image.html @@ -1,8 +1,10 @@ {% if src %} {# If the image's URL is internal to the site... #} {% if src is not starting_with("http") %} - {# ... then prepend the site's base URL to the image's URL. #} - {% set src = config.base_url ~ src %} + {# ... then convert the page's colocated_path attribute to a string so it can be concatenated... #} + {% set colocated_path = page.colocated_path | as_str %} + {# ... and use `resize_image` to get image's URL for colocated blog posts and non-colocated blog posts. #} + {% set image = resize_image(path=colocated_path ~ src, width=5000, height=5000, op="fit") %} {% endif %} {% endif %}