[% DEFAULT
  title = 'Rapi::Blog'
-%]
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="[%- mount_url -%]/img/favicon.ico">

    <!-- [%#  
      Note: the reason behind all the using of [% mount_url %] below is to safely support the option
      of mounting the plack app at a sub-url, and is not strictly required/needed. We could have also
      defined a 'base' or just relied on relative paths. This scaffold is just for example purposes
    %] -->

    <title>[% title %]</title>

    <!-- Bootstrap core CSS -->
    <link href="[%- mount_url -%]/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="[%- mount_url -%]/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
    
    <link href="[%- mount_url -%]/fonts/font-awesome.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="[%- mount_url -%]/css/blog.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    
    <!--
      <script src="js/google-code-prettify.js"></script>
    -->
    
    <script src="[%- mount_url -%]/js/picoModal.js"></script>
    <script src="[%- mount_url -%]/js/subcomment_popups.js"></script>
  </head>

  <body>

    <div class="blog-masthead">
      <div class="cog-link">
        <a href="[%- mount_url -%]/adm" title="Admin">
          <img style="max-height:100%;max-width:100%;" src="img/Cog-64.png" />
        </a>
      </div>
    
      <div class="container">
      
      
        <nav class="blog-nav">
        
          [% FOREACH page IN scaffold.pages %]
            [%- IF page.path == request_path %]
              <a class="blog-nav-item active" href="[%- mount_url -%][%- page.path -%]">[%- page.title -%]</a>
            [%- ELSE %]
              <a class="blog-nav-item" href="[%- mount_url -%][%- page.path -%]">[%- page.title -%]</a>
            [%- END %]
          [% END %]
          
          [% IF scaffold.new_post_link %]
            <a class="blog-nav-item" href="[%- add_post_path('navable') -%]">
              <i class="fa fa-plus"></i>&nbsp;New Post
            </a>
          [% END %]
        
          <form class="navbar-form navbar-right" action="[%- mount_url -%]/list">
            <div class="form-group">
              <input type="text" class="form-control" name="search">
            </div>
            <button type="submit" class="btn btn-success">Search</button>
            
            <div style="padding-left:10px;display:inline-block;">
              [% INCLUDE private/login_control.html %]
            </div>
            
          </form>
        </nav>
      </div>
    </div>

    <div class="container">

      <div class="blog-header">
        [% IF scaffold.title %]
          <h1 class="blog-title" style="margin-top:5px;">[% scaffold.title %]</h1>
        [% END %]
        [% IF scaffold.subtitle %]
          <p class="lead blog-description">[% scaffold.subtitle %]</p>
        [% END %]
      </div>

      <div class="row">

        <div class="col-sm-8 blog-main">
        
        [% content %]

        </div><!-- /.blog-main -->

        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
          [% IF scaffold.sidebar_blurb %]
            <div class="sidebar-module sidebar-module-inset">
              [% sidebar_blurb_template = scaffold.sidebar_blurb %]
              [% INCLUDE $sidebar_blurb_template %]
            </div>
          [% END %]

          
          <div class="sidebar-module">
            
            [%- SET categories_result = list_categories({limit => 15}) -%]
            [% IF categories_result.total > 0 %]
            
              <h4>Categories</h4>
              <ol class="list-unstyled">
                [% FOREACH category IN categories_result.rows %]
                  <li>
                    <a href="[%- mount_url -%]/list?category=[% category.name %]">[% category.name %]</a> 
                    ([% category.posts_count %])
                  </li>
                 [% END %]
                 [% IF categories_result.remaining %]
                  <b style="padding-left:10px;"> ... <a href="[%- mount_url -%]/categories">see all [[% categories_result.total %]]</a></b>
                 [% END %]
              </ol>
              <br>
            [% END %]

          
            <h4>Popular Tags</h4>
            <ol class="list-unstyled">
              [%- SET tags_result = list_tags({limit => 8}) -%]
              [% FOREACH tag IN tags_result.rows %]
                <li>
                  <a href="[%- mount_url -%]/list?tag=[% tag.name %]">[% tag.name %]</a> 
                  ([% tag.posts_count %])
                </li>
               [% END %]
               [% IF tags_result.remaining %]
                <b style="padding-left:10px;"> ... <a href="[%- mount_url -%]/tags">see all [[% tags_result.total %]]</a></b>
               [% END %]
               [% IF tags_result.total == 0 %]
                 <li>(no tags yet)</li> 
               [% END %]
            </ol>
            
            <br>
            
            <h4>Recent Tags</h4>
            <ol class="list-unstyled">
              [%- SET tags_result = list_tags({limit => 6,sort => 'recent'}) -%]
              [% FOREACH tag IN tags_result.rows %]
                <li>
                  <a href="[%- mount_url -%]/list?tag=[% tag.name %]">[% tag.name %]</a> 
                  ([% tag.posts_count %])
                </li>
               [% END %]
               [% IF tags_result.remaining %]
                <b style="padding-left:10px;"> ... <a href="[%- mount_url -%]/tags?sort=recent">
                    see all [[% tags_result.total %]]
                </a></b>
               [% END %]
               [% IF tags_result.total == 0 %]
                 <li>(no tags yet)</li> 
               [% END %]
            </ol>
            
            [% IF scaffold.sidebar_bottom %]
              <br>
              [% sidebar_bottom_template = scaffold.sidebar_bottom %]
              [% INCLUDE $sidebar_bottom_template %]
            [% END %]
            
          </div>
        </div><!-- /.blog-sidebar -->

      </div><!-- /.row -->

    </div><!-- /.container -->

    <footer class="blog-footer">
      <p>Blog template built for <a href="http://getbootstrap.com">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>.</p>
      <p>
        <a href="#">Back to top</a>
      </p>
    </footer>


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="[%- mount_url -%]/js/jquery.min.js"><\/script>')</script>
    <script src="[%- mount_url -%]/js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="[%- mount_url -%]/js/ie10-viewport-bug-workaround.js"></script>
  </body>
  
  

  
</html>