@@ -201,6 +201,16 @@ class WorkPage(ColourThemeMixin, ContactMixin, SocialFields, NavigationFields, P
201201 on_delete = models .SET_NULL ,
202202 related_name = "+" ,
203203 )
204+ header_image_is_decorative = models .BooleanField (
205+ help_text = "If checked, this will make the alt text empty." ,
206+ default = False ,
207+ )
208+ header_alt_text = models .CharField (
209+ blank = True ,
210+ max_length = 255 ,
211+ help_text = "By default the image title (shown above) is used as the alt text. "
212+ "Use this field to provide more specific alt text if required." ,
213+ )
204214
205215 header_caption = models .CharField ("caption" , max_length = 255 , blank = True )
206216 header_attribution = models .CharField ("attribution" , max_length = 255 , blank = True )
@@ -226,6 +236,8 @@ class WorkPage(ColourThemeMixin, ContactMixin, SocialFields, NavigationFields, P
226236 MultiFieldPanel (
227237 [
228238 FieldPanel ("header_image" ),
239+ FieldPanel ("header_alt_text" ),
240+ FieldPanel ("header_image_is_decorative" ),
229241 FieldPanel ("header_caption" ),
230242 FieldPanel ("header_attribution" ),
231243 ],
@@ -277,6 +289,12 @@ def first_author(self):
277289 return author .author
278290 return None
279291
292+ @cached_property
293+ def header_image_alt_text (self ):
294+ if header_alt_text := self .header_alt_text :
295+ return header_alt_text
296+ return self .header_image .title
297+
280298 @property
281299 def related_works (self ):
282300 prefetch_listing_images = models .Prefetch (
0 commit comments