Skip to content

Commit 98c5ccb

Browse files
committed
Fix layout on mobile version of the site
1 parent c8ac1f7 commit 98c5ccb

File tree

3 files changed

+208
-1
lines changed

3 files changed

+208
-1
lines changed

assets/media/logo.png

15.8 KB
Loading

config/_default/params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ site_type: Organization
1616
local_business_type: ''
1717
org_name: 'Quantum PL & Verification Bibliography'
1818
description: Quantum Programming Languages & Verification Bibliography
19-
twitter: ''
19+
twitter: 'Quantum Programming Languages & Verification Bibliography'
2020

2121
# Contact (edit or remove options as required)
2222

layouts/partials/navbar.html

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
{{ $show_navbar := site.Params.main_menu.enable | default true }}
2+
{{ if $show_navbar }}
3+
4+
{{ $current_page := . }}
5+
{{ $highlight_active_link := site.Params.main_menu.highlight_active_link | default true }}
6+
{{ $show_current_language := site.Params.main_menu.show_language | default false }}
7+
8+
{{/* Get site logo. */}}
9+
{{ $show_logo := site.Params.main_menu.show_logo | default true }}
10+
{{ $has_logo := fileExists "assets/media/logo.png" | or (fileExists "assets/media/logo.svg") }}
11+
{{ $logo := "" }}
12+
{{ if $has_logo }}
13+
{{ $logo = (partial "functions/get_logo" (dict "constraint" "max_height" "size" 70)) }}
14+
{{ end }}
15+
16+
<nav class="navbar navbar-expand-lg navbar-light compensate-for-scrollbar" id="navbar-main">
17+
<div class="container-xl">
18+
19+
{{if $show_logo}}
20+
<div class="d-none d-lg-inline-flex">
21+
<a class="navbar-brand" href="{{ "/" | relLangURL }}">
22+
{{- site.Title -}}
23+
</a>
24+
</div>
25+
{{end}}
26+
27+
{{ if site.Menus.main }}
28+
<button type="button" class="navbar-toggler" data-toggle="collapse"
29+
data-target="#navbar-content" aria-controls="navbar-content" aria-expanded="false" aria-label="{{ i18n "toggle_navigation" }}">
30+
<span><i class="fas fa-bars"></i></span>
31+
</button>
32+
{{ end }}
33+
34+
{{if $show_logo}}
35+
<div class="navbar-brand-mobile-wrapper d-inline-flex d-lg-none">
36+
<a class="navbar-brand" href="{{ "/" | relLangURL }}">
37+
{{- if $has_logo -}}
38+
<img src="{{ $logo.RelPermalink }}" alt="{{ site.Title }}"
39+
{{with site.Params.header.image.width}}width="{{.}}"{{end}}
40+
{{with site.Params.header.image.height}}height="{{.}}"{{end}}>
41+
{{- else -}}
42+
{{- site.Title -}}
43+
{{- end -}}
44+
</a>
45+
</div>
46+
{{end}}
47+
48+
<!-- Collect the nav links, forms, and other content for toggling -->
49+
{{ $align_menu := site.Params.main_menu.align | default "l" }}
50+
<div class="navbar-collapse main-menu-item collapse {{ if eq $align_menu "c" }}justify-content-center{{ else if eq $align_menu "r" }}justify-content-end{{else}}justify-content-start{{ end }}" id="navbar-content">
51+
52+
<!-- Left Nav Bar -->
53+
<ul class="navbar-nav d-md-inline-flex">
54+
{{ range site.Menus.main }}
55+
56+
{{ if .HasChildren }}
57+
<li class="nav-item dropdown">
58+
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true">
59+
{{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}}
60+
<span class="caret"></span>
61+
</a>
62+
<div class="dropdown-menu">
63+
{{ range .Children }}
64+
<a class="dropdown-item" href="{{ .URL | relLangURL }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}>
65+
{{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}}
66+
</a>
67+
{{ end }}
68+
</div>
69+
</li>
70+
71+
{{ else }}
72+
73+
{{/* Set target for link. */}}
74+
{{ $.Scratch.Set "target" "" }}
75+
{{ if gt (len .URL) 4 }}
76+
{{ if eq "http" (slicestr .URL 0 4) }}
77+
{{ $.Scratch.Set "target" " target=\"_blank\" rel=\"noopener\"" }}
78+
{{ end }}
79+
{{ end }}
80+
81+
{{/* Get active page. */}}
82+
83+
{{ $is_link_in_current_path := false }}
84+
{{ $is_widget_page := or $current_page.IsHome (eq $current_page.Type "widget_page") }}
85+
{{ $is_same_page := false }}
86+
{{ $hash := findRE "#(.+)" .URL }}
87+
88+
{{ if $current_page.IsHome | and (or (eq .URL "/") (eq .URL "")) }}
89+
{{ $is_link_in_current_path = true }}
90+
{{else}}
91+
{{ if gt (len .URL) 1 }}{{/* Ignore root URL */}}
92+
{{ $is_link_in_current_path = in $current_page.RelPermalink .URL }}
93+
{{ $is_same_page = $is_link_in_current_path }}
94+
{{end}}
95+
{{ if gt (len $hash) 0 }}
96+
{{ $hash = index $hash 0 }}
97+
{{ $hash_removed := replace .URL $hash "" }}
98+
{{ if eq (len $hash_removed) 0 }}
99+
{{ $hash_removed = "/" }}{{/* Add robustness for `/#SECTION` or `#SECTION` in `menus.toml`. */}}
100+
{{ end }}
101+
{{ $is_same_page = eq (path.Dir $current_page.RelPermalink) (path.Dir ($hash_removed|relLangURL)) }}
102+
{{ end }}
103+
{{end}}
104+
105+
<li class="nav-item">
106+
<a class="nav-link {{if and $highlight_active_link $is_link_in_current_path }} active{{end}}" href="{{.URL | relLangURL}}"{{ if and $is_widget_page $is_same_page }} data-target="{{$hash}}"{{ end }}{{ ($.Scratch.Get "target") | safeHTMLAttr }}>
107+
{{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}}
108+
</a>
109+
</li>
110+
111+
{{ end }}
112+
{{ end }}
113+
114+
{{ if site.Menus.main_right | and (eq $align_menu "l") }}
115+
</ul>
116+
<ul class="navbar-nav ml-md-auto">
117+
{{ end }}
118+
119+
{{ range site.Menus.main_right }}
120+
121+
{{/* Set target for link. */}}
122+
{{ $.Scratch.Set "target" "" }}
123+
{{ if gt (len .URL) 4 }}
124+
{{ if eq "http" (slicestr .URL 0 4) }}
125+
{{ $.Scratch.Set "target" " target=\"_blank\" rel=\"noopener\"" }}
126+
{{ end }}
127+
{{ end }}
128+
129+
<li class="nav-item">
130+
<a class="nav-link" href="{{ .URL | relLangURL }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}{{ ($.Scratch.Get "target") | safeHTMLAttr }}>
131+
{{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}}
132+
</a>
133+
</li>
134+
135+
{{ end }}
136+
</ul>
137+
</div><!-- /.navbar-collapse -->
138+
139+
<ul class="nav-icons navbar-nav flex-row ml-auto d-flex pl-md-2">
140+
141+
{{/* Display any social links that the superuser chose to display in the header. */}}
142+
{{ range where (where (where site.Pages "Section" "authors") ".Params.superuser" true) ".Params.social" "!=" nil }}
143+
{{ range where .Params.social ".display.header" true }}
144+
{{ $social_link := partial "functions/get_social_link" . }}
145+
<li class="nav-item d-none d-lg-inline-flex">
146+
<a class="nav-link" href="{{ $social_link.link | safeURL }}"{{ with $social_link.tooltip }} data-toggle="tooltip" data-placement="bottom" title="{{.}}"{{ end }} {{ $social_link.target | safeHTMLAttr }} aria-label="{{ $social_link.aria_label }}">
147+
<i class="{{ $social_link.icon_pack }} {{ $social_link.pack_prefix }}-{{ $social_link.icon }}" aria-hidden="true"></i>
148+
</a>
149+
</li>
150+
{{ end }}
151+
{{ end }}
152+
153+
{{ $show_search := site.Params.main_menu.show_search | default true }}
154+
{{ if and site.Params.search.provider $show_search }}
155+
<li class="nav-item">
156+
<a class="nav-link js-search" href="#" aria-label="{{ i18n "search" }}"><i class="fas fa-search" aria-hidden="true"></i></a>
157+
</li>
158+
{{ end }}
159+
160+
{{ $show_day_night := site.Params.main_menu.show_day_night | default true }}
161+
{{ if and site.Params.day_night $show_day_night }}
162+
<li class="nav-item dropdown theme-dropdown">
163+
<a href="#" class="nav-link" data-toggle="dropdown" aria-haspopup="true" aria-label="{{ i18n "theme_selector" | default "Display preferences" }}">
164+
<i class="fas fa-moon" aria-hidden="true"></i>
165+
</a>
166+
<div class="dropdown-menu">
167+
<a href="#" class="dropdown-item js-set-theme-light">
168+
<span>{{ i18n "theme_light" | default "Light" }}</span>
169+
</a>
170+
<a href="#" class="dropdown-item js-set-theme-dark">
171+
<span>{{ i18n "theme_dark" | default "Dark" }}</span>
172+
</a>
173+
<a href="#" class="dropdown-item js-set-theme-auto">
174+
<span>{{ i18n "theme_auto" | default "Automatic" }}</span>
175+
</a>
176+
</div>
177+
</li>
178+
{{ end }}
179+
180+
{{ $show_translations := site.Params.main_menu.show_translations | default true }}
181+
{{ if .IsTranslated | and $show_translations }}
182+
<li class="nav-item dropdown i18n-dropdown">
183+
<a href="#" class="nav-link {{ if $show_current_language }}dropdown-toggle{{end}}" data-toggle="dropdown"
184+
aria-haspopup="true" aria-label="{{ i18n "languages" | default "Languages" }}">
185+
<i class="fas fa-globe mr-1" aria-hidden="true"></i>
186+
{{- if $show_current_language -}}
187+
<span class="d-none d-lg-inline">{{ index site.Data.i18n.languages .Lang }}</span>
188+
{{- end -}}
189+
</a>
190+
<div class="dropdown-menu">
191+
<div class="dropdown-item dropdown-item-active">
192+
<span>{{ index site.Data.i18n.languages .Lang }}</span>
193+
</div>
194+
{{ range .Translations }}
195+
<a class="dropdown-item" href="{{ .Permalink }}"{{ if $.IsHome }} data-target="{{ .RelPermalink }}"{{ end }}>
196+
<span>{{ index site.Data.i18n.languages .Lang }}</span>
197+
</a>
198+
{{ end }}
199+
</div>
200+
</li>
201+
{{ end }}
202+
203+
</ul>
204+
205+
</div><!-- /.container -->
206+
</nav>
207+
{{end}}{{/* End show navbar. */}}

0 commit comments

Comments
 (0)