Skip to content

Commit 92a5916

Browse files
wachterjohannesluca-rath
authored andcommitted
01 - Add a header image to the homepage
1 parent 9dfd503 commit 92a5916

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

config/image-formats.xml

+4-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55

66
<!-- See: http://docs.sulu.io/en/latest/book/image-formats.html how to define image-formats -->
77

8-
<!--
9-
<format key="300x">
8+
<format key="x400">
109
<meta>
11-
<title lang="en">Example Image</title>
12-
<title lang="de">Beispielbild</title>
10+
<title lang="en">Header Image</title>
11+
<title lang="de">Titelbild</title>
1312
</meta>
1413

15-
<scale x="300"/>
14+
<scale y="400"/>
1615
</format>
17-
-->
1816

1917
<format key="1920x">
2018
<meta>

config/templates/pages/homepage.xml

+11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@
3636
<tag name="sulu.rlp"/>
3737
</property>
3838

39+
<property name="headerImage" type="single_media_selection">
40+
<meta>
41+
<title lang="en">Header image</title>
42+
<title lang="de">Titelbild</title>
43+
</meta>
44+
45+
<params>
46+
<param name="types" value="image"/>
47+
</params>
48+
</property>
49+
3950
<property name="article" type="text_editor">
4051
<meta>
4152
<title lang="en">Article</title>

templates/pages/homepage.html.twig

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{% block content %}
44
<section class="jumbotron text-center">
55
<div class="container">
6+
{% if content.headerImage|default %}
7+
<img src="{{ content.headerImage.thumbnails['x400'] }}" class="img-fluid" alt="{{content.headerImage.title}}"/>
8+
{% endif %}
69
<h1 class="jumbotron-heading">{{ content.title }}</h1>
710
<p class="lead text-muted">{{ content.article|raw }}</p>
811
</div>

0 commit comments

Comments
 (0)