<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd">
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1">

  <head>
    <meta name="dtb:uid" content="<%= bookId %>" />
    <meta name="dtb:depth" content="1" />
    <meta name="dtb:totalPageCount" content="0" />
    <meta name="dtb:maxPageNumber" content="0" />
  </head>
  <docTitle>
    <text>
      <%= title %>
    </text>
  </docTitle>
  <navMap>
    <% let playOrder=1; %>

      <!-- Direct link to the Table of Contents page -->
      <navPoint id="navPoint-<%= playOrder %>" playOrder="<%= playOrder++ %>">
        <navLabel>
          <text>Table of Contents</text>
        </navLabel>
        <content src="toc.xhtml" />
      </navPoint>

      <% content.forEach(function(item) { %>
        <% if(item.excludeFromToc) { %>
          <navPoint id="navPoint-<%= playOrder %>" playOrder="<%= playOrder++ %>" class="chapter">
            <navLabel>
              <text>
                <%= item.title %>
              </text>
            </navLabel>
            <content
              src="<%= item.filename || (item.articles && item.articles[0] && item.articles[0].filename) || '#' %>" />
          </navPoint>
          <% } %>
            <% if(item.articles) { %>
              <% item.articles.forEach(function(article) { %>
                <navPoint id="navPoint-<%= playOrder %>" playOrder="<%= playOrder++ %>">
                  <navLabel>
                    <text>
                      <%= article.title %>
                        <% if(article.author && !article.title.includes(article.author)) { %> | <%= article.author %>
                            <% } %>
                    </text>
                  </navLabel>
                  <content src="<%= article.filename %>" />
                </navPoint>
                <% }); %>
                  <% } %>
                    <% }); %>
  </navMap>
</ncx>