extends ../layouts/main-sidebar

include components/list

include ../components/pagination-bar

block content


  if Array.isArray(posts) && (posts.length > 0)
    h3= `Posts with the tag ${tag}.`
    ul.uk-list.uk-list-divider
      each post in posts
        li
          +renderPostSummaryFull(post)

    .uk-card-footer
      +renderPaginationBar(`/tag/${tagSlug}`, posts.length )
        //- li
          if post.image
            img(src= `/image/${post.image._id}`, href=`/post/${post.slug}`, style="max-height: 350px; object-fit: cover; vertical-align:middle;margin:0px 20px;").responsive
          else
            img(src="/img/default-poster.jpg", href=`/post/${post.slug}`, style="max-height: 350px; object-fit: cover; vertical-align:middle;margin:0px 20px;").responsive
          a(href=`/post/${post.slug}`).uk-display-block
            div.h2= post.title

          .uk-article-meta
            div(uk-grid).uk-grid-small.uk-text-small
              .uk-width-expand
                a(href=`/post/${post.slug}`)= moment(post.created).fromNow()
                  span  by 
                    a(href=`/user/${post.author.username}`)=` ${post.author.username}`
          .uk-width-expand
            div= post.summary

  else
    h3= `There are no posts with the tag ${tag}.`