Skip to content

Commit 6ff2735

Browse files
Fix homepage layout (#142)
This fixes the homepage layout by batching the services into groups of 2 in order to output a div with a 'row' class.
1 parent 59d2920 commit 6ff2735

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

app/_layouts/product.njk

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
{% block content %}
44
{{ content }}
5-
<div class="govuk-grid-row">
6-
{# Paginate posts if front matter includes the pagination key #}
7-
{% if pagination %}
5+
{# Paginate posts if front matter includes the pagination key #}
6+
{% if pagination %}
7+
<div class="govuk-grid-row">
88
<section class="govuk-grid-column-two-thirds">
99
<h2 class="govuk-heading-l govuk-!-font-size-27">
1010
{{ posts.title or app.posts.title or "Posts" }}
@@ -23,44 +23,50 @@
2323
items: pagination | itemsFromPagination
2424
}) if pagination.pages.length > 1 }}
2525
</section>
26-
{% if aside or related %}
26+
</div>
27+
{% if aside or related %}
28+
<div class="govuk-grid-row">
2729
<div class="govuk-grid-column-one-third">
2830
{% include "layouts/shared/related.njk" %}
2931
</div>
30-
{% endif %}
31-
{# List sections (pages with a parent that is the homepage) if homepage has no pagination key set #}
32-
{% elif eleventyNavigation.key == options.homeKey %}
32+
</div>
33+
{% endif %}
34+
{# List sections (pages with a parent that is the homepage) if homepage has no pagination key set #}
35+
{% elif eleventyNavigation.key == options.homeKey %}
3336

34-
{% set sections = [
35-
{ title: "Screening", services: [
36-
"Bowel screening",
37-
"Cohort manager",
38-
"Explore team",
39-
"HPV Self-Sampling",
40-
"Manage breast screening",
41-
"Manage your screening"
42-
] },
43-
{ title: "Vaccinations", services: [
44-
"Book a vaccination",
45-
"Manage vaccinations in schools",
46-
"Manage your appointments",
47-
"Record a vaccination",
48-
"Select people for invitation"
49-
] },
50-
{ title: "Personalised prevention", services: [
51-
"Personalised prevention platform",
52-
"Smoking cessation"
53-
] }
54-
] %}
37+
{% set sections = [
38+
{ title: "Screening", services: [
39+
"Bowel screening",
40+
"Cohort manager",
41+
"Explore team",
42+
"Manage breast screening",
43+
"Manage your screening"
44+
] },
45+
{ title: "Vaccinations", services: [
46+
"Book a vaccination",
47+
"Manage vaccinations in schools",
48+
"Manage your appointments",
49+
"Record a vaccination",
50+
"Select people for invitation"
51+
] },
52+
{ title: "Personalised prevention", services: [
53+
"Personalised prevention platform",
54+
"Smoking cessation"
55+
] }
56+
] %}
5557

56-
{% for section in sections %}
58+
{% for section in sections %}
59+
<div class="govuk-grid-row">
5760
<div class="govuk-grid-column-two-thirds">
5861
<h2 class="govuk-heading-l">
5962
{{ section.title }}
6063
</h2>
6164
</div>
65+
</div>
6266

63-
{% for service in section.services %}
67+
{% for batch in section.services | batch(2) %}
68+
<div class="govuk-grid-row">
69+
{% for service in batch %}
6470
{% for item in collections.all | eleventyNavigation(options.homeKey) %}
6571
{% if (service == item.title) %}
6672
<section class="govuk-grid-column-one-half govuk-!-margin-bottom-6">
@@ -72,8 +78,11 @@
7278
{% endif %}
7379
{% endfor %}
7480
{% endfor %}
81+
</div>
7582
{% endfor %}
83+
{% endfor %}
7684

85+
<div class="govuk-grid-row">
7786
<div class="govuk-grid-column-full">
7887
<hr class="govuk-section-break govuk-section-break--xl govuk-section-break--visible">
7988

@@ -85,10 +94,8 @@
8594
<p class="govuk-body">{{ item.excerpt }}</p>
8695
{% endif %}
8796
{% endfor %}
88-
89-
9097
</div>
98+
</div>
9199

92-
{% endif %}
93-
</div>
100+
{% endif %}
94101
{% endblock %}

0 commit comments

Comments
 (0)