<!--This page: Side bar of container -->

<link rel="stylesheet" href="{{ .Site.BaseURL }}css/slick-theme.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/slick.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/sidebar.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/split_container.css">

<script type="text/javascript">
  function link(url) {
    location.href = url;
   }
</script>

<div class="sidebar">
  <div class="topic_list">
    {{ $maxnum := .Site.Params.sidebar_maxnum }} <!--Max number of banner-->
    {{ $dir := .Site.Params.sidebar_url }} <!--Directory of sidebar-->
    {{ $.Scratch.Set "counter" 0 }} <!--counter of number of banner-->
     
    {{ range $.Site.RegularPages }}
      {{ if $StatBanner := and (eq .Params.mkbanner true) (le now .Params.bannerEndDate) }}
      {{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
        {{ if .Params.bannerimg }} 
          <div class="topic imgsize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')">
            <img src="{{ .Site.BaseURL }}{{ .Params.bannerimg }}">
          </div>
        {{ else if .Params.image }} 
          <div class="topic bannersize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')" style="background-image: url({{ .Site.BaseURL }}{{ .Params.image }});" >
            <h1> {{dateFormat "2 Jan, 2006" .Params.date }}   </h1><br>
            <h2> {{ .Title }} </h2>
          </div>
        {{ else }}
        <div class="topic bannersize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')" style="background-image: url({{ .Site.BaseURL }}{{ .Site.Params.defaultBannerImage }});" >
            <h1> {{dateFormat "2 Jan, 2006" .Params.date }}   </h1><br>
            <h2> {{ .Title }} </h2>
          </div>
        {{ end }}<!--bannerimg-->
      {{ end }}<!--StatBanner-->
    {{ end }}<!--range-->

   <!--<h3>recent post</h3>-->
    {{ with $.Site.GetPage $dir }}
      {{ range first $maxnum .Pages.ByDate.Reverse }}
        {{$StatBanner := and (eq .Params.mkbanner true) (le now .Params.bannerEndDate) }}
        {{ if ne $StatBanner true }}
        {{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
          {{ if le ($.Scratch.Get "counter") $maxnum }} 
            {{ if .Params.bannerimg }} 
              <div class="topic imgsize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')">
                <img src="{{ .Site.BaseURL }}{{ .Params.bannerimg }}">
              </div>
            {{ else if .Params.image }} 
              <div class="topic bannersize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')" style="background-image: url({{ .Site.BaseURL }}{{ .Params.image }});" >
                <h1> {{dateFormat "2 Jan, 2006" .Params.date }}   </h1><br>
                <h2> {{ .Title }} </h2>
              </div>
              
            {{ else }}
               <div class="topic bannersize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')" style="background-image: url({{ .Site.BaseURL }}{{ .Site.Params.defaultBannerImage }});" >
                 <h1> {{dateFormat "2 Jan, 2006" .Params.date }}   </h1><br>
                 <h2> {{ .Title }} </h2>
               </div>
            {{ end }} <!--bannerimg-->
          {{ end }} <!--num of banner-->
        {{ end }}<!--exclude StatBanner-->
      {{ end }}<!--range ByDate.Reverse-->
    {{ end }}<!--from post-->
  </div> <!-- topic_list -->

</div> <!-- sidebar -->

<div class="links">
  {{ with .Site.Params.link }}
  <a href="{{ $.Site.BaseURL }}/{{ $.Site.Params.linkpath }}"><h3>{{ . }}</h3></a>
  {{ end }}
</div> <!-- links -->
<script type="text/javascript" src="{{ .Site.BaseURL }}js/slick.min.js"></script>
