github.com/mweagle/Sparta@v1.15.0/docs_source/themes/hugo-theme-learn/layouts/partials/menu.html (about)

     1  <nav id="sidebar" class="{{if $.Site.Params.showVisitedLinks }}showVisitedLinks{{end}}">
     2  
     3  {{ $currentNode := . }}
     4  {{ $showvisitedlinks := .Site.Params.showVisitedLinks }}
     5    <div id="header-wrapper">
     6      <div id="header">
     7        {{ partial "logo.html" . }}
     8      </div>
     9      {{if not .Site.Params.disableSearch}}
    10          {{ partial "search.html" . }}
    11      {{end}}
    12    </div>
    13  
    14      <div class="highlightable">
    15      <ul class="topics">
    16  
    17          {{if eq .Site.Params.ordersectionsby "title"}}  
    18            {{range .Site.Home.Sections.ByTitle}}
    19            {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}}
    20            {{end}}
    21          {{else}}
    22            {{range .Site.Home.Sections.ByWeight}}
    23            {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}}
    24            {{end}}
    25          {{end}} 
    26      </ul>
    27  
    28      {{ $disableShortcutsTitle := .Site.Params.DisableShortcutsTitle}}
    29      {{with .Site.Menus.shortcuts}}
    30        <section id="shortcuts">
    31          <h3>{{ if not $disableShortcutsTitle}}{{ T "Shortcuts-Title"}}{{ end }}</h3>
    32          <ul>
    33            {{ range sort . "Weight"}}
    34                <li> 
    35                    {{.Pre}}<a class="padding" href="{{.URL | absLangURL }}">{{safeHTML .Name}}</a>{{.Post}}
    36                </li>
    37            {{end}}
    38          </ul>
    39        </section>
    40      {{end}}
    41  
    42      {{ if or .Site.IsMultiLingual $showvisitedlinks }}
    43      <section id="prefooter">
    44        <hr/>
    45        <ul>
    46        {{ if and .Site.IsMultiLingual (not .Site.Params.DisableLanguageSwitchingButton)}}
    47          <li>
    48            <a class="padding">
    49              <i class="fas fa-language fa-fw"></i>
    50            <div class="select-style">
    51              <select id="select-language" onchange="location = this.value;">
    52            {{ $siteLanguages := .Site.Languages}}
    53            {{ $pageLang := .Page.Lang}}
    54            {{ range .Page.AllTranslations }}
    55                {{ $translation := .}}
    56                {{ range $siteLanguages }}
    57                    {{ if eq $translation.Lang .Lang }}
    58                      {{ $selected := false }}
    59                      {{ if eq $pageLang .Lang}}
    60                        <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}" selected>{{ .LanguageName }}</option>
    61                      {{ else }}
    62                        <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}">{{ .LanguageName }}</option>
    63                      {{ end }}
    64                    {{ end }}
    65                {{ end }}
    66            {{ end }}
    67          </select>
    68          <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    69            width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">
    70            <g>
    71              <g id="arrow-drop-down">
    72                <polygon points="0,63.75 127.5,191.25 255,63.75 		" />
    73              </g>
    74            </g>
    75          </svg>
    76          </div>
    77          </a>
    78          </li>
    79        {{end}}
    80        
    81        {{ if $showvisitedlinks}}
    82          <li><a class="padding" href="#" data-clear-history-toggle=""><i class="fas fa-history fa-fw"></i> {{T "Clear-History"}}</a></li>
    83        {{ end }}
    84        </ul>
    85      </section>
    86      {{ end }}
    87      <section id="footer">
    88        {{ partial "menu-footer.html" . }}
    89      </section>
    90    </div>
    91  </nav>
    92  
    93  <!-- templates -->
    94  {{ define "section-tree-nav" }}
    95  {{ $showvisitedlinks := .showvisitedlinks }}
    96  {{ $currentNode := .currentnode }}
    97   {{with .sect}}
    98    {{if and .IsSection ((not .Params.hidden) or $.showhidden)}}
    99      {{safeHTML .Params.head}}
   100      <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item 
   101          {{if .IsAncestor $currentNode }}parent{{end}}
   102          {{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}
   103          {{if .Params.alwaysopen}}parent{{end}}
   104          ">
   105        <a href="{{.RelPermalink}}">
   106            {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
   107            {{ if $showvisitedlinks}}
   108              <i class="fas fa-check read-icon"></i>
   109            {{ end }}
   110        </a>
   111        {{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
   112        {{ if ne $numberOfPages 0 }}
   113          <ul>
   114            {{ $currentNode.Scratch.Set "pages" .Pages }}
   115            {{ if .Sections}}
   116              {{ $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
   117            {{end}}
   118            {{ $pages := ($currentNode.Scratch.Get "pages") }}
   119            
   120          {{if eq .Site.Params.ordersectionsby "title"}}  
   121            {{ range $pages.ByTitle }}
   122              {{ if and .Params.hidden (not $.showhidden) }} 
   123              {{else}}
   124              {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
   125              {{end}}
   126            {{ end }}
   127          {{else}}
   128            {{ range $pages.ByWeight }}
   129              {{ if and .Params.hidden (not $.showhidden) }} 
   130              {{else}}
   131              {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
   132              {{end}}
   133            {{ end }}
   134          {{end}}
   135          </ul>
   136        {{ end }}        
   137      </li>
   138    {{else}}
   139      {{ if not .Params.Hidden }}
   140        <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item {{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}">
   141          <a href="{{ .RelPermalink}}">
   142          {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
   143          {{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
   144          </a>
   145      </li>
   146       {{ end }}
   147    {{end}}
   148   {{ end }}
   149  {{ end }}
   150