|
25 | 25 | {%- assign pages_with_sections = "" | split: "" -%} |
26 | 26 |
|
27 | 27 | {%- 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 -%} |
33 | 33 | {%- endfor -%} |
34 | 34 |
|
35 | 35 | {%- comment -%} |
|
41 | 41 |
|
42 | 42 | {%- assign ordered_sections = "" | split: "" -%} |
43 | 43 | {%- 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 -%} |
50 | 50 | {%- endfor -%} |
51 | 51 |
|
52 | 52 | {%- comment -%} |
53 | 53 | Add any sections not in the manual order list at the end |
54 | 54 | {%- endcomment -%} |
55 | 55 | {%- 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 -%} |
66 | 66 | {%- endfor -%} |
67 | 67 |
|
68 | 68 | <div class="nhsuk-width-container"> |
|
79 | 79 | {%- endcomment -%} |
80 | 80 | {% for post in sorted_pages_without_sections %} |
81 | 81 | {% unless post.has_children %} |
| 82 | + {% if post.published != false and post.title != "" and post.title != nil %} |
82 | 83 | <li class=" |
83 | 84 | nhsnotify-side-nav__item |
84 | 85 | {% if post.url == page.url %} |
|
87 | 88 | "> |
88 | 89 | <a class="nhsnotify-side-nav__link" href="{{ site.baseurl | append: post.url }}">{{ post.title }}</a> |
89 | 90 | </li> |
| 91 | + {% endif %} |
90 | 92 | {% endunless %} |
91 | 93 | {% endfor %} |
92 | 94 |
|
|
100 | 102 | {% assign sorted = section.items | sort: 'nav_order' %} |
101 | 103 | {% for post in sorted %} |
102 | 104 | {% unless post.has_children %} |
| 105 | + {% if post.published != false and post.title != "" and post.title != nil %} |
103 | 106 | <li class=" |
104 | 107 | nhsnotify-side-nav__item |
105 | 108 | {% if post.url == page.url %} |
|
108 | 111 | "> |
109 | 112 | <a class="nhsnotify-side-nav__link" href="{{ site.baseurl | append: post.url }}">{{ post.title }}</a> |
110 | 113 | </li> |
| 114 | + {% endif %} |
111 | 115 | {% endunless %} |
112 | 116 | {% endfor %} |
113 | 117 | {% endfor %} |
|
0 commit comments