Welcome to mirror list, hosted at ThFree Co, Russian Federation.

nav.html « partials « layouts - github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c38c0b6ac41351576a9292d5699cb0bb6bbebbe2 (plain)
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
{{ if .Site.Params.showMenu | default true }}
<!-- Begin Nav bar -->
<div class="container">
    <hr>
    <nav class="navbar" role="navigation" aria-label="main navigation">
        {{ $isHome := .Page.IsHome }}
        <a role="button" class="navbar-burger" data-target="navMenu" aria-label="menu" aria-expanded="false" >
          <span aria-hidden="true"></span>
          <span aria-hidden="true"></span>
          <span aria-hidden="true"></span>
        </a>
        <div class="navbar-menu {{ if $isHome }}has-content-centered{{ end }}" id="navMenu">
            <!-- look for custom menu and include it -->
            {{ if .Site.Menus.main }}
            {{ range .Site.Menus.main }}
            {{ if .HasChildren }}
            <a class="navbar-item"  href="{{ .URL }}">
                {{ .Pre }}
                {{ .Name }}
                {{ .Post }}
            </a>
            {{ range .Children }}
            <!-- TODO: style children diffrent then parents-->
            <a class="navbar-item" href="{{ .URL }}">
                {{ .Pre }}
                {{ .Name }}
                {{ .Post }}
            </a>
            {{ end }}
            {{ else }}
            <a class="navbar-item" href="{{ .URL }}">
                {{ .Pre }}
                {{ .Name }}
                {{ .Post }}
            </a>
            {{ end }}
            {{ end }}
            {{ else }}
            <!-- use default menu -->
            {{ if not $isHome }}
            <a class="navbar-item" href="{{ "" | relLangURL }}">{{ i18n "nav_main" . }}</a>
            {{ end }}

            {{ with .Site.GetPage "/home" }}
            {{ $pages := .Resources.ByType "page" }}

            {{ with .Site.GetPage "/blog" }}
                {{ $pages = $pages | append . }}
            {{ end }}

            {{ with .Site.GetPage "/projects" }}
                {{ $pages = $pages | append . }}
            {{ end }}

            {{ range sort $pages "Params.weight" }}
            {{ if ne .Name "contact.md" }}
            {{ if eq (os.Stat .File.Dir).Name "projects" }}
                <!-- Now for some cool projects -->
                {{ if $isHome }}
                <a class="navbar-item" href="{{ printf "#%s" ( .Title | urlize) | relLangURL }}">{{ .Title | markdownify }}</a>
                {{ else }}
                {{ $pageIsInProjects := eq $.Page.Section "projects"}}
                {{ if not (and $pageIsInProjects (eq $.Page.Kind "section")) }}
                  <a class="navbar-item" href="{{ .Permalink }}">
                  {{ if $pageIsInProjects }}
                  {{ i18n "nav_backToSection" . }}
                  {{ else }}
                  <!-- fix-224 -->
                  {{ .Title }}
                  <!-- end fix-224 -->
                  {{ end }}
                  </a>
                {{ end }}
                {{ end }}
            {{ else if eq (os.Stat .File.Dir).Name "blog" }}
                <!-- Let`s show some blog posts -->
                {{ if $isHome }}
                <a class="navbar-item" href="{{ printf "#%s" ( .Title | urlize) | relLangURL }}">{{ .Title | markdownify }}</a>
                {{ else }}
                {{ $pageIsInBlog := eq $.Page.Section "blog"}}
                {{ if not (and $pageIsInBlog (eq $.Page.Kind "section")) }}
                  <a class="navbar-item" href="{{ .Permalink }}">
                  {{ if $pageIsInBlog }}
                  {{ i18n "nav_backToSection" . }}
                  {{ else }}
                  {{ .Title | singularize}}
                  {{ end }}
                  </a>
                {{ end }}
                {{ end }}
            {{ else }}
            <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "#%s" (.File.TranslationBaseName | urlize) | relLangURL }}{{ end }}">{{ .Title | markdownify }}</a>
            {{ end }}
            {{ end }}
            {{ end }}
            {{ end }}

            {{ with .Site.GetPage "/home" }}
            {{ with .Resources.GetMatch "contact.md" }}
            <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "#%s" (.File.TranslationBaseName | urlize) | relLangURL }}{{ end }}">{{ .Title | markdownify }}</a>
            {{ end }}
            {{ end }}

            {{ range $.Site.Home.AllTranslations.ByWeight }}
            {{ if ne .Language.LanguageName $.Language.LanguageName }}
            <a class="navbar-item" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
            {{ end }}
            {{ end }}

            {{ if and .Site.Params.showRSSButton .Site.RSSLink }}
            <a class="navbar-item" href="{{ .Site.RSSLink }}"><i class="fas fa-rss"></i></a>
            {{ end }}
            {{ end }}
        </div>
    </nav>
    <hr>
</div>
<!-- End Nav bar -->
{{ end }}