{{ define "main" }}

{{ .Scratch.Set "skipSeeAlso" true }}

{{ partial "primary_top.html" . }}

<p>{{ .Description }}</p>

{{ if .Params.content_above }}
{{ .Content }}
{{ end }}

<div class="section-index">
    {{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
    {{ $parent := .Page }}

    {{ if $parent.Params.simple_list }}
        <ul>
            {{ range $pages }}
                {{ if eq .Parent $parent }}
                    <li><a href="{{ .Permalink }}">{{- .Title -}}</a></li>
                {{ end }}
            {{ end }}
        </ul>
    {{ else }}
        {{ range $pages }}
            {{ if eq .Parent $parent }}
                <div class="entry">
                    <h5>
                        <a href="{{ .Permalink }}">{{- if .Params.icon -}}<i class="page-icon">
                                {{- partial "icon.html" .Params.icon -}}</i>{{- end -}}{{- .Title -}}</a>
                    </h5>
                    <p>{{ .Description }}</p>
                </div>
            {{ end }}
        {{ end }}
    {{ end }}
</div>

{{ if not .Params.content_above }}
{{ .Content }}
{{ end }}

{{ partial "primary_bottom.html" . }}

{{ end }}