{{ $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 }}
{{/* We don't need to render the nav tabs if there is only one committee */}} {{ if not (eq $committee_count 1) }} {{ $.Scratch.Set "counter" 0}} {{ end }} {{ $.Scratch.Set "types_counter" 0}}
{{ range $ordered_committees }} {{ $committee_name := index . "committee_name" }} {{ $items := index . "items" }} {{ $types_counter := $.Scratch.Get "types_counter" }} {{ if eq $types_counter 0 }}
{{ else }}
{{ end }} {{/* Creates an iterable sequence or slice. The value of the slice is equal to the year if yearly sections are enabled. */}} {{ $sections := seq 1 }} {{ if $yearly_sections_enabled }} {{ $sections = index $committee_years_set $committee_name }} {{ end }} {{ range $section_name := $sections }} {{ $year := "" }} {{ if $yearly_sections_enabled }} {{ $year = $section_name }} {{ end }}
{{ if $yearly_sections_enabled }}
{{ $year }}
{{ end }}
    {{/* Meeting minutes to render for current section */}} {{ $meeting_minutes := slice }} {{ if $yearly_sections_enabled }} {{ range $meeting_minute := (where $items "year" $year) }} {{ $meeting_minutes = $meeting_minutes | append $meeting_minute }} {{ end }} {{ else }} {{ $meeting_minutes = $items }} {{ end }} {{ range $index, $el := $meeting_minutes }} {{/* Handle relative and absolute paths */}} {{ $url := "" }} {{ if and $data.dir (not (hasPrefix $el.url "http") ) }} {{ $url = (path.Join $data.dir $el.url) | absURL }} {{ else }} {{ $url = $el.url }} {{ end }}
  • {{ $el.title }}
  • {{ end }}
{{ end }}
{{ $.Scratch.Add "types_counter" 1}} {{ end }}