Skip to content

Header Text Menu #606

Answered by Kugeleis
Kugeleis asked this question in Q&A
Discussion options

You must be logged in to vote

Lean back, I asked chatGTP:
"I found this: your menu-extra.html
which requires an icon to work. Please modify this code so that elements without icon work, too, and only show text."
And it spit out

{{ $current := .current }}
{{ template "menu-extra" dict "sect" .source "current" $current "site" $current.Site "target" .target }}


<!-- template -->
{{ define "menu-extra" }}
  {{ $current := .current }}
  {{ $site := .site }}
  {{ $target := .target }}
  {{ $sect := .sect }}

  {{ range sort (default (seq 0) $sect) "weight" }}
    {{ if isset . "ref" }}
      {{ $this := $site.GetPage .ref }}
      {{ $isCurrent := eq $current $this }}
      {{ $icon := default "" .icon }}

      {{ $name :…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Kugeleis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants