mirror of https://github.com/onweru/compose.git

weru
21.31.2023 a87b8344748a849d7a03063decfa7af795bc98a8
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
{{- $s := .Site }}
{{- $sp := $s.Params }}
<nav class="wrap nav menu">
    <a href='{{ absLangURL "" }}' class="nav_brand">
        {{- $logos := $sp.logo }}
        {{- $litPath := absURL ($logos.lightMode) }}
        {{- $darkPath := absURL ($logos.darkMode) }}
        <picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
            <img src="{{ $litPath }}" alt="{{ $s.Title }} Logo">
        </picture>
        <label class="nav_toggle toggle" title='{{ T "site_menu" }}' role="button">
            {{ partial "sprite" (dict "icon" "harmburger") }}
        </label>
    </a>
    <ul class="nav_body">
        <li class="nav-item">
            {{- partial "search" . }}
        </li>
        {{- $p := . }}
        {{- range $s.Menus.main }}
        <li class="nav-item">
            {{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }}
            {{- with .Page }}
            {{- $active = or $active ( $.IsDescendant .)  }}
            {{- end }}
            {{- $url := absLangURL .URL }}
            {{- if or (hasPrefix .URL "http") (hasPrefix .URL "www.") }}
                {{- $url = .URL }}
            {{- end }}
            <a class="nav-link{{if $active }} active{{end}}" href="{{ $url }}"><span{{if $active }} class="active"{{end}}>{{ T .Identifier | default .Name }}</span></a>
        </li>
        {{- end }}
        {{ $repo := $sp.source }}
        <li class="nav-item nav_repo">
            <a class="nav-link" href="{{ $repo.url }}" target="_blank">
                {{ if $repo.iconLight }}
                    {{- $litPath := absURL ($repo.iconLight) }}
                    {{- $darkPath := absURL ($repo.iconDark) }}
                    <picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
                        <img src="{{ $litPath }}" alt="{{ $repo.name }} Repo">
                    </picture>
                {{ else }}
                    {{ $repo.name }}
                {{ end }}
            </a>
        </li>
        <li class="nav-item">{{ partial "mode" . }}</li>
    </ul>
</nav>