{{ define "main_content" }}
<main class="cell{{ if not (or .Site.Params.sidebar.disable .Params.sidebar.disable) }} medium-8{{ end }}" {{ if eq .Section "posts" }}itemscope itemtype="http://schema.org/Blog"{{ end }}>
    <article id="post-article" {{ if eq .Section "posts" }}itemprop="blogPost" itemscope itemtype="http://schema.org/BlogPosting"{{ else }}itemscope itemtype="http://schema.org/Article"{{ end }}{{ if .Params.tags }} itemref="keywords desc"{{ else }} itemref="desc"{{ end }}>
        <header id="page-header">
            <h1 itemprop="headline">{{ .Title }}</h1>
            {{- if or (or (not .Lastmod.IsZero) (not .Date.IsZero)) .Params.categories -}}
                <p id="post-metadata" class="grid-x grid-padding-x">
                {{- if not .Date.IsZero -}}
                    <span class="cell shrink">
                        <span class="far fa-clock fa-sm fa-fw" aria-hidden></span>
                        <strong>{{ i18n "publishedLabel" | title }}:</strong>
                        <time datetime="{{ .Date.Format "2006-01-02" }}" content="{{ .Date.Format "2006-01-02" }}" itemprop="datePublished">{{ .Date.Format "January 02, 2006" }}</time>
                    </span>
                {{- end -}}
                {{- if and (not .Lastmod.IsZero) (ne .Lastmod .Date) -}}
                    <span class="cell shrink">
                        <span class="far fa-clock fa-sm fa-fw" aria-hidden></span>
                        <strong>{{ (i18n "lastUpdatedLabel") | title }}:</strong>
                        <time datetime="{{ .Lastmod.Format "2006-01-02" }}" content="{{ .Lastmod.Format "2006-01-02" }}" itemprop="dateModified">{{ .Lastmod.Format "January 02, 2006" }}</time>
                    </span>
                {{- end -}}
                {{- if .Params.categories -}}
                    <span class="cell shrink">
                        <span class="fas fa-folder fa-sm fa-fw" aria-hidden></span>
                        <span class="sr-text">{{ i18n "categoryLabel" (len .Params.categories) | title }}: </span>
                        {{ range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end -}}
                        {{ $url :=$category | urlize | lower | printf "categories/%s" }}
                        <a href="{{ partial "make_link" (dict "URL" $url "Root" $) }}" rel="category">{{ . | humanize | title }}</a>{{ end }}
                    </span>
                {{- end -}}
                {{- if not .Params.hide_readingtime -}}
                    <span class="cell shrink">
                        <span class="fas fa-book fa-sm fa-fw" aria-hidden></span>
                        <strong>{{ i18n "estimatedTimeLabel" | title }}:</strong>
                        ~<span itemprop="timeRequired">{{ i18n "estimatedTime" .ReadingTime }}</span>
                    </span>
                {{- end -}}
                {{- with .Params.tags -}}
                    <span class="cell shrink">
                        <span class="fas fa-tag{{ if gt (len .) 1 }}s{{ end }} fa-sm fa-fw" aria-hidden></span>
                        {{- range . }}
                            {{ $link := printf "/tags/%s" (urlize .) }}
                            {{ $link := lower $link  }}
                            <a itemprop="relatedUrl" itemscope itemtype="http://schema.org/URL" href="{{ partial "make_link" (dict "URL" $link "Root" $) }}" rel="tag" itemprop="url">{{ . | humanize | lower }}</a>
                        {{ end -}}
                    </span>
                {{- end -}}
                </p>
            {{ end }}
        </header>
        {{ with .Params.alert -}}
        <div class="callout">
            {{ . | markdownify }}
        </div>
        {{- end }}
        <div id="post-content">
            {{- if .Params.thumbnail -}}
                <figure class="thumbnail">
                    <img src="{{ partial "make_link" (dict "URL" .Params.thumbnail "Root" $) }}" alt="{{ .Title }}">
                </figure>
            {{- end -}}
            {{- partial "toc.html" $ -}}
            <span itemprop="articleBody">{{ partial "content.html" $ }}</span>
        </div>
        {{- partial "pages/authorbox.html" . -}}
    </article>

    {{ partial "next_prev_post.html" . }}

    {{ partial "pages/comments.html" . }}
</main>
{{ end }}
