Skip to content

Commit

Permalink
fix: add image cache busting
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesrocket committed Jan 22, 2024
1 parent 5ea0aa2 commit 1e3ce40
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% block body %}<body id="posts">{% endblock body %}
<div class="block-left">
<div class="content">
{% if current_path | default(value="none") != "/" %}<a href="{{ config.base_url }}" class="logo"><img src="{{ get_url(path=config.extra.logo) }}", alt="logo" width="64" height="64"></a>{% endif %}
{% if current_path | default(value="none") != "/" %}<a href="{{ config.base_url }}" class="logo"><img src="{{ get_url(path=config.extra.logo, cachebust=true) }}", alt="logo" width="64" height="64"></a>{% endif %}
{% block left %}
<h1 class="section-title">{%- block page_title %}{% if page.title %}{{ page.title }}{% elif section.title %}{{ section.title }}{% elif term.name %}{{ '#' ~ term.name }}{% else %}{% endif %}{% endblock page_title %}</h1>
{% endblock left %}
Expand Down
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block body %}<body id="homepage">{% endblock body %}
{% block left %}
<div class="main-info">
{% if config.extra.home_logo %}<a href="{{ config.base_url }}" class="logo"><img src="{{ get_url(path=config.extra.logo) }}", alt="logo" width="64" height="64"></a>{% endif %}
{% if config.extra.home_logo %}<a href="{{ config.base_url }}" class="logo"><img src="{{ get_url(path=config.extra.logo, cachebust=true) }}", alt="logo" width="64" height="64"></a>{% endif %}
<h1>
<i class="hero glitch-h1 layers" data-text="{{ config.extra.home_title }}"><span>{{ config.extra.home_title }}</span></i>
</h1>
Expand Down
6 changes: 3 additions & 3 deletions templates/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{%- else %}
{%- set page_url = get_url(path="404.html", trailing_slash=true) %}
{%- endif %}
{% if config.extra.home_image is starting_with("https://") %}{% set home_image = config.extra.home_image %}{% else %}{% set home_image = get_url(path=config.extra.home_image) %}{% endif %}
{% if config.extra.post_list_image is starting_with("https://") %}{% set post_list_image = config.extra.post_list_image %}{% else %}{% set post_list_image = get_url(path=config.extra.post_list_image) %}{% endif %}
{% if config.extra.default_post_image is starting_with("https://") %}{% set default_post_image = config.extra.default_post_image %}{% else %}{% set default_post_image = get_url(path=config.extra.default_post_image) %}{% endif %}
{% if config.extra.home_image is starting_with("https://") %}{% set home_image = config.extra.home_image %}{% else %}{% set home_image = get_url(path=config.extra.home_image, cachebust=true) %}{% endif %}
{% if config.extra.post_list_image is starting_with("https://") %}{% set post_list_image = config.extra.post_list_image %}{% else %}{% set post_list_image = get_url(path=config.extra.post_list_image, cachebust=true) %}{% endif %}
{% if config.extra.default_post_image is starting_with("https://") %}{% set default_post_image = config.extra.default_post_image %}{% else %}{% set default_post_image = get_url(path=config.extra.default_post_image, cachebust=true) %}{% endif %}
{% if config.extra.csp %}{% if page.extra.image %}
{% set page_image_hash = get_hash(literal=macros::image_style(url=page.extra.image), base64=true, sha_type=512) %}
{% else %}
Expand Down
2 changes: 1 addition & 1 deletion templates/shortcodes/image.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<figure>
<center>
<a href={{ link }}>
<img class="align-center page-image" src="{{ img }}" alt="{{ alt }}"/>
<img class="align-center page-image" src="{{ get_url(path=img, cachebust=true) }}" alt="{{ alt }}"/>
</a>
<figcaption>{{ caption }}</figcaption>
</center>
Expand Down

0 comments on commit 1e3ce40

Please sign in to comment.