Allow images to be optional

This commit is contained in:
Jake Howard 2022-06-15 09:33:53 +01:00
parent 8aea60da35
commit 339ffde323
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 4 additions and 2 deletions

View file

@ -3,7 +3,9 @@
{% load wagtailimages_tags %}
{% block content %}
<img class="hero" src="{% image_url page.hero_image 'width-1200' %}" alt="">
{% if page.hero_image %}
<img class="hero" src="{% image_url page.hero_image 'width-1200' %}">
{% endif %}
<section class="hero container">
<div class="hero-body">

View file

@ -3,7 +3,7 @@
{% load wagtailimages_tags %}
{% block main %}
<main style="background-image: url({% image_url page.image 'width-1200' %})">
<main {% if page.image %}style="background-image: url({% image_url page.image 'width-1200' %})"{% endif %}>
<h1>{{ page.heading }}</h1>
<input id="search-input" class="input" type="text" placeholder="Search">