{{ define "title" }}
  {{ if eq .Data.Singular "tag" }}Tag → {{ .Data.Term }}
  {{ else if eq .Data.Singular "category" }}Category → {{ .Data.Term }}
  {{ else }}
    {{ $currentPage := . }}
    {{ range .Site.Menus.main }}
      {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
        {{ .Name }}
      {{ end }}
    {{ end }}
  {{ end }}
  {{ if isset .Site.Params "seotitle" }} | {{ .Site.Params.seotitle }}{{ else }} | {{ .Site.Title }}{{ end }}
{{ end }}

{{ define "main" }}

    <main id="content" role="main" class="main commerce-landing">
      <section class="main entry-list commerce-hero-content-wrapper center overflow-hidden">

<!--  <section class="main entry-list"> -->
    <header class="list-header">
      {{ $currentPage := . }}
      {{ range .Site.Menus.main }}
        {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }}
          <h2 class="list-label">{{ .Name }} Posts</h2>
        {{ end }}
      {{ end }}
    </header>
	
	 {{.Content}}
	 
    {{ $paginator := .Paginate (where .Pages "Type" "post") (index .Site.Params "paginate" | default 10) }}
    {{ if ne $paginator.TotalPages 0 }}
      {{ range $paginator.Pages.ByDate.Reverse }}
        {{ .Render "summary" }}
      {{ end }}
    {{ else }}
      <p>There's nothing here.<br>Create an interesting post with the command:</p>
      <p><code>$ hugo new post/hello-world.md</code></p>
    {{ end }}
    {{ if gt $paginator.TotalPages 1 }}
      <nav class="pagination">
        {{ if $paginator.HasPrev }}
          <a class="pagination-btn" href="{{ $paginator.Prev.URL }}">← Newer Posts</a>
        {{ end }}
        {{ if $paginator.HasNext }}
          <a class="pagination-btn pagination-next" href="{{ $paginator.Next.URL }}">Older Posts →</a>
        {{ end }}
      </nav>
    {{ end }}
  </section>
  
    </main>
  
{{ end }}
