<%- include('../../functions') -%>

<%
  var
    articles = page.articles || [],
    features = site.pages.filter(thePage => thePage.content_type === 'feature') || [],
    featuresByPath = features.reduce((acc, curr) => {
        acc[`/${curr.path}`] = curr;
        return acc;
    }, {});
    /*


    card_url = "http://gatherer.wizards.com/Pages/Search/Default.aspx?name=+[%22CARD-NAME%22]",
    detail_url = "http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=",
    image_url = "/images/magic/commanders/",
    deck = page.deck || {},
    info = deck.info || {},
    cards = deck.cards || [],
    lands = deck.lands || [],
    changes = deck.changes || [],
    starting_lands = info.starting_lands || [],

    commander = info.commander && info.commander_id ?
      "<li><a href='" + detail_url + info.commander_id + "' target='_blank'>" + info.commander +
        "</a> <em>(Commander)</em></li>" :
      "",
    commander_img = info.commander && info.commander_img ?
      "<img src='" + image_url + info.commander_img + "' class='magic-commander-img' alt='" + info.commander + " card' />":
      ""
    ;
    */
-%>
<div class="zineIssue-wrapper">
  <h2 class="zineIssue-title">
    <%=page.title%>
  </h2>
  <% articles.forEach((curr) => { -%>
    <% var currArticle = featuresByPath[curr] || {}; %>
    <h2 class="zineIssue-featureTitle">
      <%=currArticle.title || '' -%>
    </h2>
    <%-currArticle.content || '' -%>
    <hr />
  <% }) %>
</div>
