Load potentially external images without referrer

This commit is contained in:
Jake Howard 2024-01-17 19:37:47 +00:00
parent 8c72558ca6
commit 5ff5ad113b
Signed by: jake
GPG key ID: 57AFB45680EDD477
3 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@
<figure class="media-left column is-3 image-column"> <figure class="media-left column is-3 image-column">
{% if page.list_image_url %} {% if page.list_image_url %}
<a href="{% pageurl page %}" class="image" title="{{ page.title }}"> <a href="{% pageurl page %}" class="image" title="{{ page.title }}">
<img src="{{ page.list_image_url }}" alt="{{ page.hero_image_alt }}" loading="lazy" decoding="async" /> <img src="{{ page.list_image_url }}" alt="{{ page.hero_image_alt }}" loading="lazy" decoding="async" referrerpolicy="no-referrer" />
</a> </a>
{% endif %} {% endif %}
</figure> </figure>

View file

@ -15,7 +15,7 @@
<picture> <picture>
{% for width, image_url in page.hero_image_urls.items reversed %}<source srcset="{{ image_url }}" media="(max-width: {{ width }}px)" />{% endfor %} {% for width, image_url in page.hero_image_urls.items reversed %}<source srcset="{{ image_url }}" media="(max-width: {{ width }}px)" />{% endfor %}
<img class="hero" src="{{ page.hero_image_url }}" decoding="async" alt="{{ page.hero_image_alt }}" /> <img class="hero" src="{{ page.hero_image_url }}" referrerpolicy="no-referrer" decoding="async" alt="{{ page.hero_image_alt }}" />
</picture> </picture>
{% endif %} {% endif %}

View file

@ -14,6 +14,6 @@ class UnsplashPhotoChooser(AdminChooser):
def get_title(self, instance: UnsplashPhoto) -> str: def get_title(self, instance: UnsplashPhoto) -> str:
return format_html( return format_html(
"<img src='{}' width=165 loading='lazy' decoding='async'>", "<img src='{}' width=165 loading='lazy' decoding='async' referrerpolicy='no-referrer'>",
instance.get_thumbnail_url(), instance.get_thumbnail_url(),
) )