{{ $data := .Site.Data.meeting_minutes }} {{ $yearly_sections_enabled := $data.yearly_sections_enabled | default false }} {{/* We need to create a set of years for each committee in order to know which year sections to render. */}} {{ $committee_years_set := dict }} {{ if $yearly_sections_enabled }} {{ range $key, $committee := $data.items }} {{ $years_set := slice }} {{ range $committee }} {{ if not (in $years_set .year) }} {{ $years_set = $years_set | append .year }} {{ end }} {{ end }} {{ $committee_years_set = merge $committee_years_set (dict $key $years_set) }} {{ end }} {{ end }} {{/* We need to sort the committees by the `order` field in the data file. To do this, we create an ordered slice containing a dict with the committee name as the key and the committee object as value. The committee object which originally comes from `items` in the data file. If no `order` field was provided then the default behavior of YAML gets used (alphabetical). */}} {{ $ordered_committees := slice }} {{ if $data.order }} {{ range $committee_name := $data.order }} {{ $committee := index $data.items $committee_name }} {{ $ordered_committees = $ordered_committees | append (dict "committee_name" $committee_name "items" $committee) }} {{ end }} {{ else }} {{ range $committee_name, $committee := $data.items }} {{ $ordered_committees = $ordered_committees | append (dict "committee_name" $committee_name "items" $committee) }} {{ end }} {{ end }} {{ $committee_count := len $data.items }}