<!-- 文章 -->
<article class="post">
    <header>
        <!-- 标签这有且只能显示一个 -->
        <% if (post.categories && post.categories.length) { %>
        <%-
            list_categories(post.categories, {
                show_count: false,
                class: 'cat',
                style: 'none',
                separator: '|'
            }).split('|')[0]
        %>
        <% } else { %>
            <a href="javascript: void(0);" class="cat">未分类</a>
        <% } %>
        <!-- 文章标题 -->
        <%- partial('post/title', { class_name: 'post-title' }) %>
    </header>
    <p class="post-meta">
        <%- post.author || '柠烟夏季' %> 发表于
        <%- partial('post/date', { date_format: 'YYYY-MM-DD' }) %>
        &nbsp;&nbsp;
        <span class="post-tags">
            标签：
            <%- partial('post/tag') %>
        </span>
    </p>

    <div class="post-content">
        <div class="post-excerpt">
            <% if (index == true) { %>
                <%- post.blogexcerpt || post.excerpt || post.content %>
            <% } %>
            <p class="more">
                <a href="<%- url_for(post.permalink) %>">阅读全文</a>
            </p>
        </div>
        <div class="post-thumbnail" data-img="<%- post.photos[0] %>">
            <a href="<%= post.permalink %>" title="<%= post.title %>">
                <% 
                var numSum = 0
                let dateNum = parseInt(date(post.date, 'YYYYMMDDHHmmss'))
                let mutipart = 10
                while(dateNum % mutipart != dateNum) {
                    numSum += Math.floor(dateNum % mutipart / (mutipart/10))
                    mutipart *= 10
                }
                if (post.thumbnail) { 
                %>
                    <!--
                    <%- image_tag(post.thumbnail, { class: "thumbnail" }) %>
                    -->
                    <img class="thumbnail" src="<%- url_for('img/loading2.gif') %>" data-echo="<%= post.thumbnail %>" alt="<%= post.title %>" >
                <% } else if (post.photos.length) { %>
                    <img class="thumbnail" src="<%- url_for('img/loading2.gif') %>" data-echo="<%= url_for(post.photos[0]) %>" alt="<%= post.title %>" >
                <% } else if (theme.CDN) { %>
                    <img class="thumbnail" src="<%- url_for('img/loading2.gif') %>" data-echo="<%- url_for(theme.CDN + 'thumbnail/' + numSum%10  + '.jpg') %>" alt="默认配图" >
                <% } else  { %>
                    <img class="thumbnail" src="<%- url_for('img/loading2.gif') %>" data-echo="<%- url_for('img/thumbnail/' + numSum%10  + '.jpg') %>" alt="默认配图" >
                <% } %>
            </a>
        </div>
    </div>
</article>
