<!--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 }});" >
            <div class="title"> <h2> {{ .Title }} </h2> </div><br>
            <div class="date"> Posted on {{dateFormat "2 Jan, 2006" .Params.date }}   </div>
          </div>
        {{ else }}
        <div class="topic bannersize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')" style="background-image: url({{ .Site.BaseURL }}{{ .Site.Params.defaultBannerImage }});" >
            <div class="title"> <h2> {{ .Title }} </h2></div><br>
            <div class="date"> Posted on {{dateFormat "2 Jan, 2006" .Params.date }}   </div>
          </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 false) (le now .Params.bannerEndDate) }}
        {{ if eq $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 }});" >
                <div class="title"> <h2> {{ .Title }} </h2> </div><br>
                <div class="date"> Posted on {{dateFormat "2 Jan, 2006" .Params.date }}   </div>
              </div>

            {{ else }}
               <div class="topic bannersize" onKeyPress="return true" onClick="link('{{ .Site.BaseURL }}{{ .RelPermalink }}')" style="background-image: url({{ .Site.BaseURL }}{{ .Site.Params.defaultBannerImage }});" >
                <div class="title"> <h2> {{ .Title }} </h2> </div><br>
                 <div class="date"> Posted on {{dateFormat "2 Jan, 2006" .Params.date }}   </div>
               </div>
            {{ end }} <!--bannerimg-->
          {{ end }} <!--num of banner-->
        {{ end }}<!--exclude StatBanner-->
      {{ end }}<!--range ByDate.Reverse-->
    {{ end }}<!--from post-->


  <script src="{{ .Site.BaseURL }}js/topic.js"></script>
  </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>
