diff --git a/blurry/plugins/jinja_plugins/blurry_image_extension.py b/blurry/plugins/jinja_plugins/blurry_image_extension.py index 041716f..36aacd5 100644 --- a/blurry/plugins/jinja_plugins/blurry_image_extension.py +++ b/blurry/plugins/jinja_plugins/blurry_image_extension.py @@ -19,7 +19,12 @@ class BlurryImage(StandaloneTag): tags = {"blurry_image"} def render(self, *args, **kwargs): - (image_url, width) = args + if len(args) == 2: + (image_url, width) = args + else: + image_url = args[0] + width = None + image_content_path: str = "." + urlparse(image_url).path image_path = get_build_directory() / image_content_path diff --git a/docs/content/templates/syntax.md b/docs/content/templates/syntax.md index 9b07fb2..87aae0e 100644 --- a/docs/content/templates/syntax.md +++ b/docs/content/templates/syntax.md @@ -62,11 +62,11 @@ It does a few things: Basic example: ```jinja -{% blurry_image page.thumbnailUrl, alt="Image description" %} +{% blurry_image page.image, alt=page.name + " image" %} ``` Example with explicit width (image with this width must be present in the build folder): ```jinja -{% blurry_image page.thumbnailUrl, 250, id="image-id", class="responsive-image", loading="lazy" %} +{% blurry_image page.image, 250, alt=page.name + " image", id="image-id", class="responsive-image", loading="lazy" %} ```