Skip to content

Commit

Permalink
01 - Add a header image to the homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored and niklasnatter committed Jun 20, 2022
1 parent 607f272 commit a2908ef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
10 changes: 4 additions & 6 deletions config/image-formats.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@

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

<!--
<format key="300x">
<format key="x400">
<meta>
<title lang="en">Example Image</title>
<title lang="de">Beispielbild</title>
<title lang="en">Header Image</title>
<title lang="de">Titelbild</title>
</meta>

<scale x="300"/>
<scale y="400"/>
</format>
-->

<format key="1920x">
<meta>
Expand Down
11 changes: 11 additions & 0 deletions config/templates/pages/homepage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@
<tag name="sulu.rlp"/>
</property>

<property name="headerImage" type="single_media_selection">
<meta>
<title lang="en">Header image</title>
<title lang="de">Titelbild</title>
</meta>

<params>
<param name="types" value="image"/>
</params>
</property>

<property name="article" type="text_editor">
<meta>
<title lang="en">Article</title>
Expand Down
3 changes: 3 additions & 0 deletions templates/pages/homepage.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{% block content %}
<section class="jumbotron text-center">
<div class="container">
{% if content.headerImage|default %}
<img src="{{ content.headerImage.thumbnails['x400'] }}" class="img-fluid" alt="{{content.headerImage.title}}"/>
{% endif %}
<h1 class="jumbotron-heading">{{ content.title }}</h1>
<p class="lead text-muted">{{ content.article|raw }}</p>
</div>
Expand Down

0 comments on commit a2908ef

Please sign in to comment.