github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/menu.html (about)

     1  
     2      {{- $showvisitedlinks := .Site.Params.showVisitedLinks }}
     3      {{- $format := partial "get-format.hugo" . }}
     4      {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
     5      {{- $basename := "index" }}
     6      {{- if eq $outputFormat "searchpage" }}
     7        {{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
     8      {{- end }}
     9      <aside id="R-sidebar" class="default-animation{{ if $showvisitedlinks }} showVisitedLinks{{ end }}">
    10        {{- $currentNode := . }}
    11        <div id="R-header-topbar" class="default-animation"></div>
    12        <div id="R-header-wrapper" class="default-animation">
    13          <div id="R-header" class="default-animation">
    14  {{ partial "logo.html" . }}
    15          </div>
    16          {{- if not .Site.Params.disableSearch }}
    17  {{ partial "search.html" . }}
    18          {{- end }}
    19        </div>
    20        <div id="R-homelinks" class="default-animation{{ if not .Site.Params.disableLandingPageButton }} homelinks{{ end }}">
    21        {{- if not .Site.Params.disableLandingPageButton }}
    22          {{- if (ne .Site.Params.landingPageURL nil) }}
    23            {{- warnf "%q: UNSUPPORTED usage of 'landingPageURL' config parameter found, remove it and optionally overwrite the `logo.html` partial to provide a link if it should not point to the project's home page; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#420" .File.Filename }}
    24          {{- end }}
    25          <ul>
    26            <li><a class="padding" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .Site.Home) }}">{{ .Site.Params.landingPageName | default `<i class="fa-fw fas fa-home"></i> Home` | safeHTML }}</a></li>
    27          </ul>
    28        {{- end }}
    29          <hr class="padding">
    30        </div>
    31        <div id="R-content-wrapper" class="highlightable">
    32          <div id="R-topics">
    33            <ul class="enlarge morespace collapsible-menu">
    34              {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" .Site.Home "hidden" true) }}
    35              {{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
    36              {{- range $pages }}
    37                {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
    38              {{- end }}
    39            </ul>
    40          </div>
    41          {{- $page := . }}
    42          {{- $disableShortcutsTitle := .Site.Params.DisableShortcutsTitle }}
    43          {{- with .Site.Menus.shortcuts }}
    44          <div id="R-shortcuts">
    45            <div class="nav-title padding">{{ if not $disableShortcutsTitle }}{{ T "Shortcuts-Title" }}{{ end }}</div>
    46            <ul class="space">
    47              {{- range sort . "Weight" }}
    48                {{- $shortcut := . }}
    49                {{- with $page.Site.GetPage (printf "%s" $shortcut.URL ) }}
    50                  {{- $to := . }}
    51              <li>{{ $shortcut.Pre }}<a class="padding" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{ safeHTML $shortcut.Name }}</a>{{ $shortcut.Post }}</li>
    52                {{- else }}
    53              <li>{{ $shortcut.Pre }}<a class="padding" href="{{ $shortcut.URL | relLangURL }}">{{ safeHTML $shortcut.Name }}</a>{{ $shortcut.Post }}</li>
    54                {{- end }}
    55              {{- end }}
    56            </ul>
    57          </div>
    58          {{- end }}
    59          {{- $siteLanguages := .Site.Languages }}
    60          {{- $showlangswitch := and .Site.IsMultiLingual (not .Site.Params.disableLanguageSwitchingButton) (gt (int (len $siteLanguages)) 1) }}
    61          {{- $themevariants := partialCached "get-theme-variants.hugo" . }}
    62          {{- $showvariantswitch := gt (int (len $themevariants)) 1 }}
    63          {{- $footer := partial "menu-footer.html" . }}
    64          {{- $showfooter := not (eq 0 (int (len ($footer | plainify)))) }}
    65          <div class="padding footermargin footerLangSwitch footerVariantSwitch footerVisitedLinks footerFooter{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}{{if $showfooter}} showFooter{{end}}"></div>
    66          <div id="R-menu-footer">
    67            <hr class="padding default-animation footerLangSwitch footerVariantSwitch footerVisitedLinks footerFooter{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}{{if $showfooter}} showFooter{{end}}">
    68            <div id="R-prefooter" class="footerLangSwitch footerVariantSwitch footerVisitedLinks{{if $showlangswitch}} showLangSwitch{{end}}{{if $showvariantswitch}} showVariantSwitch{{end}}{{if $showvisitedlinks}} showVisitedLinks{{end}}">
    69              <ul>
    70                <li id="R-select-language-container" class="footerLangSwitch{{if $showlangswitch}} showLangSwitch{{end}}">
    71                  <div class="padding menu-control">
    72                    <i class="fa-fw fas fa-language"></i>
    73                    <span>&nbsp;</span>
    74                    <div class="control-style">
    75                      <label class="a11y-only" for="R-select-language">{{ T "Language" }}</label>
    76                      <select id="R-select-language" onchange="location = this.querySelector( this.value ).dataset.url;">
    77                        {{- $page := .Page }}
    78                        {{- $pageLang := .Page.Language.Lang }}
    79                        {{- range .Page.AllTranslations }}
    80                        <option id="R-select-language-{{ .Language.Lang }}" value="#R-select-language-{{ .Language.Lang }}" data-url="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "basename" $basename) }}" lang="{{ .Language.LanguageCode }}"{{ if eq $pageLang .Language.Lang }} selected{{ end }}>{{ .Language.LanguageName }}</option>
    81                        {{- end }}
    82                      </select>
    83                    </div>
    84                    <div class="clear"></div>
    85                  </div>
    86                </li>
    87                <li id="R-select-variant-container" class="footerVariantSwitch{{if $showvariantswitch}} showVariantSwitch{{end}}">
    88                  <div class="padding menu-control">
    89                    <i class="fa-fw fas fa-paint-brush"></i>
    90                    <span>&nbsp;</span>
    91                    <div class="control-style">
    92                      <label class="a11y-only" for="R-select-variant">{{ T "Theme" }}</label>
    93                      <select id="R-select-variant" onchange="window.variants && variants.changeVariant( this.value );">
    94                        {{- $firstvariant := true }}
    95                        {{- range $themevariants }}
    96                          {{- $themevariant := . }}
    97                        <option id="R-select-variant-{{ $themevariant.identifier }}" value="{{ $themevariant.identifier }}"{{- if $firstvariant }} selected{{ end }}>{{ $themevariant.name }}</option>
    98                          {{- $firstvariant = false }}
    99                        {{- end }}
   100                      </select>
   101                    </div>
   102                    <div class="clear"></div>
   103                  </div>
   104                  <script>window.variants && variants.markSelectedVariant();</script>
   105                </li>
   106                <li class="footerVisitedLinks{{if $showvisitedlinks}} showVisitedLinks{{end}}">
   107                  <div class="padding menu-control">
   108                    <i class="fa-fw fas fa-history"></i>
   109                    <span>&nbsp;</span>
   110                    <div class="control-style">
   111                      <button onclick="clearHistory();">{{ T "Clear-History" }}</button>
   112                    </div>
   113                    <div class="clear"></div>
   114                  </div>
   115                </li>
   116              </ul>
   117            </div>
   118            <div id="R-footer" class="footerFooter{{if $showfooter}} showFooter{{end}}">
   119              {{- $footer }}
   120            </div>
   121          </div>
   122        </div>
   123      </aside>
   124      {{- define "section-tree-nav" }}
   125        {{- $currentNode := .currentnode }}
   126        {{- $showvisitedlinks := .showvisitedlinks }}
   127        {{- $alwaysopen := .alwaysopen }}
   128        {{- $currentFileRelPermalink := .currentnode.RelPermalink }}
   129        {{- with .sect }}
   130          {{- $isSelf := eq .RelPermalink $currentFileRelPermalink }}
   131          {{- $isAncestor := and (not $isSelf) (.IsAncestor $currentNode) }}
   132          {{- $isActive := $isSelf }}
   133          {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }}
   134          {{- $relearnIsHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
   135          {{- $hidden := and $relearnIsHiddenFrom (not $.showhidden) (not $isSelf) (not $isAncestor) }}
   136          {{- if $hidden }}
   137          {{- else }}
   138            {{- $numberOfVisibleChildren := 0 }}
   139            {{- range $pages }}
   140              {{- $isSelfSub := eq .RelPermalink $currentFileRelPermalink }}
   141              {{- $isAncestorSub := and (not $isSelf) (.IsAncestor $currentNode) }}
   142              {{- $relearnIsSubHiddenFrom := index ($currentNode.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
   143              {{- $subHidden := and $relearnIsSubHiddenFrom (not $.showhidden) (not $isSelfSub) (not $isAncestorSub) }}
   144              {{- $numberOfVisibleChildren = add $numberOfVisibleChildren (int (not $subHidden)) }}
   145            {{- end }}
   146            {{- safeHTML .Params.head }}
   147            {{- if $numberOfVisibleChildren }}
   148              {{- $title := or .Params.menuTitle .LinkTitle .Title }}
   149              {{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}
   150              {{- $isCollapsible := or (.Params.collapsibleMenu | default .Site.Params.collapsibleMenu) (not $url) }}
   151              {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
   152              {{- $pageHash := md5 .Page }}
   153              {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
   154            <li data-nav-id="{{ $url }}" class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $currentAlwaysopen}}alwaysopen{{end}}">{{ if $isCollapsible }}<input type="checkbox" id="R-section-{{ $pageHash }}" aria-controls="R-subsections-{{ $pageHash }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $pageHash }}"><i class="fa-fw fas fa-chevron-down"></i><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}{{ if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
   155              {{- partial "menu-pre.html" . }}{{ $title }}{{ partial "menu-post.html" . }}
   156              {{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $pageHash }}" class="morespace collapsible-menu">
   157              {{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}
   158              {{- range $pages }}
   159                {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
   160              {{- end }}</ul></li>
   161            {{- else }}
   162              {{- $title := or .Params.menuTitle .LinkTitle .Title }}
   163              {{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}
   164            <li data-nav-id="{{ $url }}" class="{{if $isActive }}active{{end}}">{{ if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
   165                {{- partial "menu-pre.html" . }}{{ $title }}{{ partial "menu-post.html" . }}
   166                {{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
   167            {{- end }}
   168          {{- end }}
   169        {{- end }}
   170      {{- end }}