{{define "main"}}
    {{if ne .Site.Params.displayRecent false}}
    <div class="section"> 
        <div class="section-title">recent</div> 
        {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
        {{range first (default  4 .Site.Params.recentMax) (where $pages "Section" "ne" .Site.Params.microBlogSection)}}
            <div class="list-item">
                <a class="entry-title" href="{{ .URL }}">{{ .Title }}</a>
                {{$page := .}}
                {{with .Description}}
                <p>{{.}}</p>
                {{end}}
                <div class="meta">
                {{with .Date}}
                    <i class="far fa-calendar-alt"></i> {{.Format "Jan 2 2006"}}
                {{end}}
                <br>
                {{with .Params.tags}}
                        <i class="fas fa-tags"></i> 
                        Tags: {{ delimit . ", " }}
                {{end}}
                </div>
            </div>
        {{end}}
        </div>
    {{end}}

    {{if .Site.Params.displayMicroBlog}}
    <div class="section"> 
        <div class="section-title">μblog</div> 
        <div class="posts">
            {{ range where (where site.RegularPages "Type" "in" site.Params.microBlogSection) "Params.pinned" true }}
                <div class="post">
                    <div class="meta pinned"> <i class="fas fa-thumbtack"></i> pinned </div>
                    <div class="post-content">
                        {{.Content}}
                    </div>
                    <div class="meta post-footer"> <span>{{.Date.Format "Jan 2 2006 03:04 UTC-07"}}</span> <a href="{{.URL}}"><i class="fas fa-link"></i> link</a></div> 
                </div>
            {{ end }} 
            {{ range where (where site.RegularPages "Type" "in" site.Params.microBlogSection) "Params.pinned" "ne" true}}
                <div class="post">
                    {{if ne .Params.pinned nil}}
                        <div class="meta pinned"> <i class="fas fa-thumbtack"></i> pinned </div>
                    {{end}}
                    <div class="post-content">
                        {{.Content}}
                    </div>
                    <div class="meta post-footer"> <span>{{.Date.Format "Jan 2 2006 03:04 UTC-07"}}</span> <a href="{{.URL}}"><i class="fas fa-link"></i> link</a></div> 
                </div>
            {{ end }} 
        </div>
    </div>
    {{end}}
{{end }}