Skip to content

Commit 4dd1d63

Browse files
authored
Fixing site url config (#140)
* Fix site URL and baseurl for custom domain * Adding filter to remove URL redirect pages from appearing in the side nav
1 parent e9e5b55 commit 4dd1d63

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

docs/_layouts/page.html

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
{%- assign pages_with_sections = "" | split: "" -%}
2626

2727
{%- for section in first_level -%}
28-
{%- if section.name == "" or section.name == nil -%}
29-
{%- assign pages_without_sections = pages_without_sections | concat: section.items -%}
30-
{%- else -%}
31-
{%- assign pages_with_sections = pages_with_sections | push: section -%}
32-
{%- endif -%}
28+
{%- if section.name == "" or section.name == nil -%}
29+
{%- assign pages_without_sections = pages_without_sections | concat: section.items -%}
30+
{%- else -%}
31+
{%- assign pages_with_sections = pages_with_sections | push: section -%}
32+
{%- endif -%}
3333
{%- endfor -%}
3434

3535
{%- comment -%}
@@ -41,28 +41,28 @@
4141

4242
{%- assign ordered_sections = "" | split: "" -%}
4343
{%- for section_name in section_order -%}
44-
{%- for section in pages_with_sections -%}
45-
{%- if section.name == section_name -%}
46-
{%- assign ordered_sections = ordered_sections | push: section -%}
47-
{%- break -%}
48-
{%- endif -%}
49-
{%- endfor -%}
44+
{%- for section in pages_with_sections -%}
45+
{%- if section.name == section_name -%}
46+
{%- assign ordered_sections = ordered_sections | push: section -%}
47+
{%- break -%}
48+
{%- endif -%}
49+
{%- endfor -%}
5050
{%- endfor -%}
5151

5252
{%- comment -%}
5353
Add any sections not in the manual order list at the end
5454
{%- endcomment -%}
5555
{%- for section in pages_with_sections -%}
56-
{%- assign found = false -%}
57-
{%- for ordered_section in ordered_sections -%}
58-
{%- if section.name == ordered_section.name -%}
59-
{%- assign found = true -%}
60-
{%- break -%}
61-
{%- endif -%}
62-
{%- endfor -%}
63-
{%- unless found -%}
64-
{%- assign ordered_sections = ordered_sections | push: section -%}
65-
{%- endunless -%}
56+
{%- assign found = false -%}
57+
{%- for ordered_section in ordered_sections -%}
58+
{%- if section.name == ordered_section.name -%}
59+
{%- assign found = true -%}
60+
{%- break -%}
61+
{%- endif -%}
62+
{%- endfor -%}
63+
{%- unless found -%}
64+
{%- assign ordered_sections = ordered_sections | push: section -%}
65+
{%- endunless -%}
6666
{%- endfor -%}
6767

6868
<div class="nhsuk-width-container">
@@ -79,6 +79,7 @@
7979
{%- endcomment -%}
8080
{% for post in sorted_pages_without_sections %}
8181
{% unless post.has_children %}
82+
{% if post.published != false and post.title != "" and post.title != nil %}
8283
<li class="
8384
nhsnotify-side-nav__item
8485
{% if post.url == page.url %}
@@ -87,6 +88,7 @@
8788
">
8889
<a class="nhsnotify-side-nav__link" href="{{ site.baseurl | append: post.url }}">{{ post.title }}</a>
8990
</li>
91+
{% endif %}
9092
{% endunless %}
9193
{% endfor %}
9294

@@ -100,6 +102,7 @@
100102
{% assign sorted = section.items | sort: 'nav_order' %}
101103
{% for post in sorted %}
102104
{% unless post.has_children %}
105+
{% if post.published != false and post.title != "" and post.title != nil %}
103106
<li class="
104107
nhsnotify-side-nav__item
105108
{% if post.url == page.url %}
@@ -108,6 +111,7 @@
108111
">
109112
<a class="nhsnotify-side-nav__link" href="{{ site.baseurl | append: post.url }}">{{ post.title }}</a>
110113
</li>
114+
{% endif %}
111115
{% endunless %}
112116
{% endfor %}
113117
{% endfor %}

0 commit comments

Comments
 (0)