<aside class="site-sidebar">

  {{- with .Site.Params.description }}
  <div class="sidebar-block">
    <h2 class="sidebar-heading">About</h2>
    <p class="sidebar-about">{{ . }}</p>
  </div>
  {{- end }}

  <div class="sidebar-block">
    <h2 class="sidebar-heading">Recent Posts</h2>
    <ul class="sidebar-recent-list">
      {{- range first 5 (where .Site.RegularPages "Section" "posts") }}
      <li>
        <a href="{{ .Permalink }}" class="sidebar-post-link">{{ .Title }}</a>
        <time class="sidebar-post-date" datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "Jan 2, 2006" }}</time>
      </li>
      {{- end }}
    </ul>
  </div>

  {{- $categories := .Site.Taxonomies.categories }}
  {{- if $categories }}
  <div class="sidebar-block">
    <h2 class="sidebar-heading">Categories</h2>
    <ul class="sidebar-category-list">
      {{- range $categories.ByCount }}
      <li>
        <a href="{{ .Page.Permalink }}" class="sidebar-category-link">{{ .Page.Title }}</a>
        <span class="sidebar-category-count">{{ .Count }}</span>
      </li>
      {{- end }}
    </ul>
  </div>
  {{- end }}

  {{- $tags := .Site.Taxonomies.tags }}
  {{- if $tags }}
  <div class="sidebar-block">
    <h2 class="sidebar-heading">Tags</h2>
    <div class="sidebar-tags">
      {{- range $tags.ByCount }}
      <a href="{{ .Page.Permalink }}" class="tag-pill">{{ .Page.Title }}</a>
      {{- end }}
    </div>
  </div>
  {{- end }}

</aside>
