diff --git a/website/common/models.py b/website/common/models.py index fb9bedd..ad96dbd 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -195,6 +195,13 @@ class BaseContentPage(BasePage, MetadataMixin): def list_image_url(self) -> Optional[str]: return self.hero_url("small") + @cached_property + def hero_image_alt(self) -> str: + if self.hero_unsplash_photo_id is None: + return "" + + return self.hero_unsplash_photo.data.get("description", "") + def get_meta_url(self) -> str: return self.full_url diff --git a/website/common/templates/common/listing-item.html b/website/common/templates/common/listing-item.html index 0321cb9..92fedea 100644 --- a/website/common/templates/common/listing-item.html +++ b/website/common/templates/common/listing-item.html @@ -6,7 +6,7 @@
{% if page.list_image_url %} - + {{ page.hero_image_alt }} {% endif %}
diff --git a/website/common/templates/wagtail_base.html b/website/common/templates/wagtail_base.html index 9dfb407..4d7bb69 100644 --- a/website/common/templates/wagtail_base.html +++ b/website/common/templates/wagtail_base.html @@ -15,7 +15,7 @@ {% for width, image_url in page.hero_image_urls.items reversed %}{% endfor %} - + {{ page.hero_image_alt }} {% endif %}