forked from alshedivat/al-folio
-
Notifications
You must be signed in to change notification settings - Fork 27
/
header.liquid
210 lines (207 loc) · 8.84 KB
/
header.liquid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<header>
<!-- Nav Bar -->
<nav id="navbar" class="navbar navbar-light navbar-expand-sm {% if site.navbar_fixed %}fixed-top{% else %}sticky-top{% endif %}" role="navigation">
<div class="container">
{% if page.permalink != '/' %}
<a class="navbar-brand title font-weight-lighter" href="{{ site.baseurl }}/">
{% if site.title == 'blank' %}
{% if site.first_name %}
<span class="font-weight-bold">
{{- site.first_name -}}
</span>
{% endif %}
{% if site.middle_name %}
{{- site.middle_name -}}
{% endif %}
{% if site.last_name %}
{{- site.last_name -}}
{% endif %}
{% else %}
{{- site.title -}}
{% endif %}
</a>
{% elsif site.enable_navbar_social %}
<!-- Social Icons -->
<div class="navbar-brand social">{% include social.liquid %}</div>
{% endif %}
<!-- Navbar Toggle -->
<button
class="navbar-toggler collapsed ml-auto"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar top-bar"></span>
<span class="icon-bar middle-bar"></span>
<span class="icon-bar bottom-bar"></span>
</button>
<div class="collapse navbar-collapse text-right" id="navbarNav">
<ul class="navbar-nav ml-auto flex-nowrap">
{% for page in site.pages %}
{% if page.permalink == '/' %} {% assign about_title = page.title %} {% endif %}
{% endfor %}
<!-- About -->
<li class="nav-item {% if page.permalink == '/' %}active{% endif %}">
<a class="nav-link" href="{{ '/' | relative_url }}">
{{- about_title }}
{% if page.permalink == '/' %}
<span class="sr-only">(current)</span>
{% endif %}
</a>
</li>
<!-- Other pages -->
{% assign sorted_pages = site.pages | sort: 'nav_order' %}
{% for p in sorted_pages %}
{% if p.nav and p.autogen == null %}
{% if p.dropdown %}
{% assign has_active_child = false %}
{% for child in p.children %}
{% if page.title == child.title %}
{% assign has_active_child = true %}
{% endif %}
{% endfor %}
<li class="nav-item dropdown {% if page.title == p.title or has_active_child %}active{% endif %}">
<a
class="nav-link dropdown-toggle"
href="#"
id="navbarDropdown"
role="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
{{- p.title }}
{% if page.title == p.title or has_active_child %}
<span class="sr-only">(current)</span>
{% endif %}
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
{% for child in p.children %}
{% if child.title == 'divider' %}
<div class="dropdown-divider"></div>
{% else %}
<a class="dropdown-item {% if page.title == child.title %}active{% endif %}" href="{{ child.permalink | relative_url }}">
{{- child.title -}}
</a>
{% endif %}
{% endfor %}
</div>
</li>
{% else %}
<li class="nav-item {% if page.url contains p.permalink %}active{% endif %}">
{% if p.permalink contains '/blog/' %}{% assign url = '/blog/' %} {% else %}{% assign url = p.url %}{% endif %}
<a class="nav-link" href="{{ url | relative_url }}">
{{- p.title }}
{% if page.url contains p.url %}
<span class="sr-only">(current)</span>
{% endif %}
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
<!-- Toogle language -->
{% if site.languages.size >= 2 %}
{% if site.languages.size == 2 %}
{% if site.active_lang == site.languages.first %}
{% assign other_language = site.languages.last %}
{% else %}
{% assign other_language = site.languages.first %}
{% endif %}
<li class="nav-item active">
{% if site.active_lang == site.default_lang %}
<a class="nav-link" {% static_href -%} href="{{site.baseurl}}/{{ other_language }}{{page.url}}" {%- endstatic_href %}>
{% if site.country_flag %}
<span class="fi fi-{{ other_language | split: "-" | last }}"></span>
{% else %}
{{ other_language | upcase }}
{%- endif -%}
</a>
{% else %}
<a class="nav-link" {% static_href -%} href="{{site.baseurl}}{{ page.url }}" {%- endstatic_href %}>
{% if site.country_flag %}
<span class="fi fi-{{ site.default_lang | split: "-" | last }}"></span>
{% else %}
{{ site.default_lang | upcase }}
{%- endif -%}
</a>
{% endif %}
</li>
{% else %}
<li class="nav-item dropdown {% if page.title == p.title %}active{% endif %}">
<a
class="nav-link dropdown-toggle"
href="#"
id="navbarDropdown"
role="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
{% if site.country_flag %}
<span class="fi fi-{{ site.active_lang | split: "-" | last }}"></span>
{% else %}
{{- site.active_lang | upcase }}
{%- endif -%}
{% if page.title == p.title %}
<span class="sr-only">(current)</span>
{% endif %}
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
{% assign language_set = false %}
{% for l in site.languages %}
{% if l != site.active_lang %}
{% if language_set %}
<div class="dropdown-divider"></div>
{% endif %}
{% if l == site.default_lang %}
<a class="dropdown-item" {% static_href -%} href="{{site.baseurl}}{{page.url}}" {%- endstatic_href %}>
{% if site.country_flag %}
<span class="fi fi-{{ l | split: "-" | last }}"></span>
{% else %}
{{ l | upcase }}
{%- endif -%}
</a>
{% else %}
<a class="dropdown-item" {% static_href -%} href="{{site.baseurl}}/{{l}}{{page.url}}" {%- endstatic_href %}>
{% if site.country_flag %}
<span class="fi fi-{{ l | split: "-" | last }}"></span>
{% else %}
{{ l | upcase }}
{%- endif -%}
</a>
{% endif %}
{% assign language_set = true %}
{% endif %}
{% endfor %}
</div>
</li>
{% endif %}
{% endif %}
{% if site.enable_darkmode %}
<!-- Toogle theme mode -->
<li class="toggle-container">
<button id="light-toggle" title="Change theme">
<i class="ti ti-sun-moon" id="light-toggle-system"></i>
<i class="ti ti-moon-filled" id="light-toggle-dark"></i>
<i class="ti ti-sun-filled" id="light-toggle-light"></i>
</button>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>
{% if site.enable_progressbar %}
<!-- Scrolling Progress Bar -->
<progress id="progress" value="0">
<div class="progress-container">
<span class="progress-bar"></span>
</div>
</progress>
{% endif %}
</header>