|
10 | 10 | document.body.classList.add('dark');
|
11 | 11 | }
|
12 | 12 | }
|
| 13 | + |
13 | 14 | </script>
|
14 | 15 | {{- end }}
|
15 | 16 | {{- if (and (.Site.Params.disableThemeToggle) (eq .Site.Params.defaultTheme "auto")) }}
|
16 | 17 | <script>
|
17 | 18 | if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
18 | 19 | document.body.classList.add('dark');
|
19 | 20 | }
|
| 21 | + |
20 | 22 | </script>
|
21 | 23 | {{- end }}
|
22 | 24 | <noscript>
|
|
25 | 27 | .top-link {
|
26 | 28 | display: none;
|
27 | 29 | }
|
| 30 | + |
28 | 31 | </style>
|
29 | 32 | </noscript>
|
30 | 33 | <header class="header">
|
31 | 34 | <nav class="nav">
|
32 |
| - <p class="logo"> |
| 35 | + <div class="logo"> |
33 | 36 | <a href="{{ "" | absLangURL }}">
|
34 | 37 | {{- if .Site.Params.label.icon }}
|
35 | 38 | <img src="{{- .Site.Params.label.icon -}}" alt="logo" aria-label="logo"
|
36 | 39 | height="{{- .Site.Params.label.iconHeight | default "30px" -}}">
|
37 | 40 | {{- end -}}
|
38 | 41 | {{- .Site.Params.label.text | default .Site.Title -}}
|
39 | 42 | </a>
|
40 |
| - {{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }} |
41 |
| - <span class="theme-toggle"> |
42 |
| - <a id="theme-toggle"> |
43 |
| - <svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" |
44 |
| - fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" |
45 |
| - stroke-linejoin="round"> |
46 |
| - <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path> |
47 |
| - </svg> |
48 |
| - <svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" |
49 |
| - fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" |
50 |
| - stroke-linejoin="round"> |
51 |
| - <circle cx="12" cy="12" r="5"></circle> |
52 |
| - <line x1="12" y1="1" x2="12" y2="3"></line> |
53 |
| - <line x1="12" y1="21" x2="12" y2="23"></line> |
54 |
| - <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> |
55 |
| - <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> |
56 |
| - <line x1="1" y1="12" x2="3" y2="12"></line> |
57 |
| - <line x1="21" y1="12" x2="23" y2="12"></line> |
58 |
| - <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> |
59 |
| - <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> |
60 |
| - </svg> |
61 |
| - </a> |
| 43 | + <span class="logo-switches"> |
| 44 | + {{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }} |
| 45 | + <span class="theme-toggle"> |
| 46 | + <a id="theme-toggle"> |
| 47 | + <svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" |
| 48 | + fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" |
| 49 | + stroke-linejoin="round"> |
| 50 | + <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path> |
| 51 | + </svg> |
| 52 | + <svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" |
| 53 | + fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" |
| 54 | + stroke-linejoin="round"> |
| 55 | + <circle cx="12" cy="12" r="5"></circle> |
| 56 | + <line x1="12" y1="1" x2="12" y2="3"></line> |
| 57 | + <line x1="12" y1="21" x2="12" y2="23"></line> |
| 58 | + <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> |
| 59 | + <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> |
| 60 | + <line x1="1" y1="12" x2="3" y2="12"></line> |
| 61 | + <line x1="21" y1="12" x2="23" y2="12"></line> |
| 62 | + <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> |
| 63 | + <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> |
| 64 | + </svg> |
| 65 | + </a> |
| 66 | + </span> |
| 67 | + {{- end}} |
| 68 | + {{ $lang := .Lang}} |
| 69 | + {{- with $.Site.Home.AllTranslations }} |
| 70 | + <span class="lang-switch"> |
| 71 | + <span>|</span> |
| 72 | + <ul> |
| 73 | + {{- range . -}} |
| 74 | + {{- if ne $lang .Lang }} |
| 75 | + <li> |
| 76 | + <a href="{{- .Permalink -}}" title="{{ .Language.LanguageName | default .Lang | humanize }}" |
| 77 | + aria-label="{{ .Language.LanguageName | default .Lang | humanize }}"> |
| 78 | + {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }} |
| 79 | + {{- .Language.LanguageName | humanize -}} |
| 80 | + {{- else }} |
| 81 | + {{- .Lang | humanize -}} |
| 82 | + {{- end -}} |
| 83 | + </a> |
| 84 | + </li> |
| 85 | + {{- end -}} |
| 86 | + {{- end}} |
| 87 | + </ul> |
| 88 | + </span> |
| 89 | + {{- end }} |
62 | 90 | </span>
|
63 |
| - {{- end}} |
64 |
| - </p> |
| 91 | + </div> |
65 | 92 | {{- $currentPage := . }}
|
66 | 93 | <ul class="menu" id="menu" onscroll="menu_on_scroll()">
|
67 | 94 | {{- range .Site.Menus.main }}
|
|
75 | 102 | </span>
|
76 | 103 | </a>
|
77 | 104 | </li>
|
78 |
| - {{- end }} |
| 105 | + {{- end -}} |
79 | 106 | </ul>
|
80 | 107 | </nav>
|
81 | 108 | </header>
|
1 commit comments
adityatelange commentedon Oct 26, 2020
use
params.displayFullLangName: true
to displaylanguageName
. By default key will be used