<%
function layout_topic_list(partial) {
  var el = ''
  var publish_list = theme.topic.publish_list
  var tree = theme.topic.tree
  var topics = publish_list.map(function(id) {
    return tree[id]
  }).filter(function(topic) {
    return topic != null
  }).sort(function(a, b) {
    var aDate = a.homepage && a.homepage.date ? new Date(a.homepage.date).getTime() : 0
    var bDate = b.homepage && b.homepage.date ? new Date(b.homepage.date).getTime() : 0
    return bDate - aDate
  })
  for (var topic of topics) {
    el += `<div class="post-card-wrap${scrollreveal(' ')}">`
    el += `<div class="post-card topic">`
    el += partial(topic)
    el += `</div>`
    el += `</div>`
  }
  return el
}
function layoutDiv() {
  var el = ''
  el += partial('_partial/main/navbar/nav_tabs_blog')
  el += `<div class="post-list topic">`;
  el += layout_topic_list(function(topic) {
    return partial('_partial/main/post_list/topic_card', {topic: topic})
  })
    el += `</div>`
  return el
}
%>

<%- layoutDiv() %>
