<%
if (theme.index.slogan.enable) {
  page.subtitle = theme.index.slogan.text || config.subtitle || ''
}
page.banner_img = theme.index.banner_img
page.banner_img_height = theme.index.banner_img_height
page.banner_mask_alpha = theme.index.banner_mask_alpha
%>

<% page.posts.each(function (post) { %>
  <div class="row mx-auto index-card" style="border-color: black;border-style: dashed;border-width: 1px;padding-top: 18px;padding-bottom: 18px;">
    <% var post_url = url_for(post.path), index_img = post.index_img || theme.index.post_default_img %>
    <% if(index_img) { %>
      <div class="col-12 col-md-4 m-auto index-img">
        <a href="<%- post_url %>" target="<%- theme.index.post_url_target %>">
          <img src="<%- url_for(index_img) %>" alt="<%= post.title %>">
        </a>
      </div>
    <% } %>
    <div class="col-12 col-md-<%= index_img ? '8' : '12' %> mx-auto index-info">
      <a class="index-header" href="<%- post_url %>"><%= post.title %></a>

      <a href="<%- post_url %>" class="index-excerpt">
        <% var excerpt = '' %>
        <% if(post.excerpt) { %>
          <% excerpt = strip_html(post.excerpt).substr(0, 200) %>
        <% } else if(theme.index.auto_excerpt.enable){ %>
          <% excerpt = strip_html(post.content).substr(0, 200) %>
        <% } %>
        <div><%- excerpt %></div>
      </a>

      <div class="index-btm post-metas">
        <% if(theme.index.post_meta.date ) { %>
          <div class="post-meta mr-3">
            <i class="iconfont icon-date"></i>&nbsp;<%- date(post.date, config.date_format) %>
          </div>
        <% } %>
        <% if(theme.index.post_meta.category && post.categories.length > 0) { %>
          <div class="post-meta mr-3">
            <i class="iconfont icon-category"></i>
            <% post.categories.each(function(cate){ %>
              <a href="<%= url_for(cate.path) %>"><%- cate.name %></a>
            <% }) %>
          </div>
        <% } %>
        <% if(theme.index.post_meta.tag && post.tags.length > 0) { %>
          <div class="post-meta">
            <i class="iconfont icon-tags"></i>
            <% post.tags.each(function(tag){ %>
              <a href="<%= url_for(tag.path) %>"><%- tag.name %></a>
            <% }) %>
          </div>
        <% } %>
      </div>
    </div>
  </div>
<% }) %>

<%- partial('_partial/paginator') %>
