How to declare {{ range.Params }} inside a variable


#1

Hi, im new in hugo. it is possible that i can declare .params inside a variable?

this is my code … for params

  {{ range .Params.Menu }}
              {{ .menuname }}
          {{ end }}
  • this is my condition for displaying menu with site.data
        {{ range .Site.Data.menu}}
            {{ $name := "Food" }}  --//  menuname from markdown 
            {{ if eq .name $name}}
            {{ .name }}<br>
              {{ range .menu }}
                {{ .foodname}}<br>
                  {{ range .list }}
                    {{ .name }}<br>
                    {{ .desc }}<br>
                  {{ end }}
              {{ end }}
            {{end}}
          {{ end }}

it goes like this, if $name is equal to (menuname… from params) it will display the data from .site.data

i hope you’ll understand :smiley: