feat: cache bust images in shortcodes (#504)

This commit is contained in:
Axel Karjalainen 2025-04-02 23:25:23 +03:00 committed by GitHub
parent c7bc652618
commit cc39652eb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 18 deletions

View file

@ -9,9 +9,9 @@
{#- Fallback to absolute path if relative path doesn't work -#} {#- Fallback to absolute path if relative path doesn't work -#}
{%- if not meta -%} {%- if not meta -%}
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%} {%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
{%- set image_url = get_url(path=src) -%} {%- set image_url = get_url(path=src, cachebust=true) -%}
{%- else -%} {%- else -%}
{%- set image_url = get_url(path=relative_path) -%} {%- set image_url = get_url(path=relative_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}

View file

@ -16,9 +16,9 @@
{%- set relative_light_path = colocated_path ~ light_src -%} {%- set relative_light_path = colocated_path ~ light_src -%}
{%- set light_meta = get_image_metadata(path=relative_light_path, allow_missing=true) -%} {%- set light_meta = get_image_metadata(path=relative_light_path, allow_missing=true) -%}
{%- if not light_meta -%} {%- if not light_meta -%}
{%- set light_image_url = get_url(path=light_src) -%} {%- set light_image_url = get_url(path=light_src, cachebust=true) -%}
{%- else -%} {%- else -%}
{%- set light_image_url = get_url(path=relative_light_path) -%} {%- set light_image_url = get_url(path=relative_light_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
@ -29,9 +29,9 @@
{%- set relative_dark_path = colocated_path ~ dark_src -%} {%- set relative_dark_path = colocated_path ~ dark_src -%}
{%- set dark_meta = get_image_metadata(path=relative_dark_path, allow_missing=true) -%} {%- set dark_meta = get_image_metadata(path=relative_dark_path, allow_missing=true) -%}
{%- if not dark_meta -%} {%- if not dark_meta -%}
{%- set dark_image_url = get_url(path=dark_src) -%} {%- set dark_image_url = get_url(path=dark_src, cachebust=true) -%}
{%- else -%} {%- else -%}
{%- set dark_image_url = get_url(path=relative_dark_path) -%} {%- set dark_image_url = get_url(path=relative_dark_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}

View file

@ -9,9 +9,9 @@
{#- Fallback to absolute path if relative path doesn't work -#} {#- Fallback to absolute path if relative path doesn't work -#}
{%- if not meta -%} {%- if not meta -%}
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%} {%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
{%- set image_url = get_url(path=src) -%} {%- set image_url = get_url(path=src, cachebust=true) -%}
{%- else %} {%- else %}
{%- set image_url = get_url(path=relative_path) -%} {%- set image_url = get_url(path=relative_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}

View file

@ -21,9 +21,9 @@
{%- set relative_default_path = colocated_path ~ default_src -%} {%- set relative_default_path = colocated_path ~ default_src -%}
{%- set default_meta = get_image_metadata(path=relative_default_path, allow_missing=true) -%} {%- set default_meta = get_image_metadata(path=relative_default_path, allow_missing=true) -%}
{%- if not default_meta -%} {%- if not default_meta -%}
{%- set default_image_url = get_url(path=default_src) -%} {%- set default_image_url = get_url(path=default_src, cachebust=true) -%}
{%- else -%} {%- else -%}
{%- set default_image_url = get_url(path=relative_default_path) -%} {%- set default_image_url = get_url(path=relative_default_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
@ -34,9 +34,9 @@
{%- set relative_hovered_path = colocated_path ~ hovered_src -%} {%- set relative_hovered_path = colocated_path ~ hovered_src -%}
{%- set hovered_meta = get_image_metadata(path=relative_hovered_path, allow_missing=true) -%} {%- set hovered_meta = get_image_metadata(path=relative_hovered_path, allow_missing=true) -%}
{%- if not hovered_meta -%} {%- if not hovered_meta -%}
{%- set hovered_image_url = get_url(path=hovered_src) -%} {%- set hovered_image_url = get_url(path=hovered_src, cachebust=true) -%}
{%- else -%} {%- else -%}
{%- set hovered_image_url = get_url(path=relative_hovered_path) -%} {%- set hovered_image_url = get_url(path=relative_hovered_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}

View file

@ -25,9 +25,9 @@
{%- set relative_default_path = colocated_path ~ default_src -%} {%- set relative_default_path = colocated_path ~ default_src -%}
{%- set default_meta = get_image_metadata(path=relative_default_path, allow_missing=true) -%} {%- set default_meta = get_image_metadata(path=relative_default_path, allow_missing=true) -%}
{%- if not default_meta -%} {%- if not default_meta -%}
{%- set default_image_url = get_url(path=default_src) -%} {%- set default_image_url = get_url(path=default_src, cachebust=true) -%}
{%- else -%} {%- else -%}
{%- set default_image_url = get_url(path=relative_default_path) -%} {%- set default_image_url = get_url(path=relative_default_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
@ -38,9 +38,9 @@
{%- set relative_toggled_path = colocated_path ~ toggled_src -%} {%- set relative_toggled_path = colocated_path ~ toggled_src -%}
{%- set toggled_meta = get_image_metadata(path=relative_toggled_path, allow_missing=true) -%} {%- set toggled_meta = get_image_metadata(path=relative_toggled_path, allow_missing=true) -%}
{%- if not toggled_meta -%} {%- if not toggled_meta -%}
{%- set toggled_image_url = get_url(path=toggled_src) -%} {%- set toggled_image_url = get_url(path=toggled_src, cachebust=true) -%}
{%- else -%} {%- else -%}
{%- set toggled_image_url = get_url(path=relative_toggled_path) -%} {%- set toggled_image_url = get_url(path=relative_toggled_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}

View file

@ -9,9 +9,9 @@
{#- Fallback to absolute path if relative path doesn't work -#} {#- Fallback to absolute path if relative path doesn't work -#}
{%- if not meta -%} {%- if not meta -%}
{%- set meta = get_image_metadata(path=src, allow_missing=true) -%} {%- set meta = get_image_metadata(path=src, allow_missing=true) -%}
{%- set image_url = get_url(path=src) -%} {%- set image_url = get_url(path=src, cachebust=true) -%}
{%- else %} {%- else %}
{%- set image_url = get_url(path=relative_path) -%} {%- set image_url = get_url(path=relative_path, cachebust=true) -%}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}