<% var rows=articleList;
for(var i=0;i<rows.length;i++){%>
    <div class="list_item" articleId="<%=rows[i].id%>">
        <h2><a href="<%= '/article?id='+rows[i].id%>"><%=rows[i].title%></a></h2>
        <div>
            <%if(rows[i].thumbnail ){%>
                <img src='<%=rows[i].thumbnail%>' class="thumbnail">
            <% }%>
            
            <%=rows[i].summary%>

        </div>
        <div class="artile_info">
                <%=rows[i].author %> &nbsp;<%=rows[i].createTime?this.server.getRelativeDate(rows[i].createTime):""%></span>
            <% 
            if(rows[i].tagList){
            var tagArr=rows[i].tagList.split(",")
            tagArr.forEach(function (tagId){%>
                <span class="tagItem"><%=tagMap[tagId]%></span>
            <%})
            }
            %>
            
        
        </div>
    </div>
<%}%>

<div class="page">
<% 
var pageSize=20;
var pageCount=Math.ceil(articleCount/pageSize);
var current=1;
if(context.request.query["page"]){
    current=context.request.query["page"];
}
//var start=1;end=pageCount;
var start=Math.max(1,current-5);
var end=Math.min(pageCount,current+5);

for(var i=start;i<=end;i++){
    var url=context.request.makeUrl({page:i});
    var className="";
    if(i==current){
        className="current"
    }
    
%>
<a href="<%=url%>" class="<%=className%>"><%=i%></a>
<% }%>
</div>