
<%
  var cwd = (process && process.cwd) ? process.cwd() : '';
  var titleLink = (site && site.base_uri) ? site.base_uri : '/';
  const { entriesToList, pageCount, pageNum, tag } = page;
-%>

<%- include('partials/top') %>

<!-- BEGIN TAG PAGE -->

<body class='postMainIndex'>
  <a name="top" id="topAnchor" class="topAnchor"></a>
  <div class="page">
	  <header id="header" class="pageHeader pageSection">
		  <div class="pageHeader-titleBlock clearfix">
			  <h1 class="siteTitle"><a href="<%= titleLink %>" class="siteTitle-link"><%= site.title %></a></h1>
		  </div>

      <%- include('partials/navmain') %>

    </header>
    
    <main id="content" class="pageMain pageSection">
		  <div class="pageMain-inner">

        <%- include('partials/embed_switch') -%>

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

        <% if (page.title && (page.render_opts || '').indexOf('no_title') == -1) { -%>

          <h2>
            Journal Entries By Tag: <a
              class="boxLink isCurrent"
              href="<%= page.path %>"
              id="<%= snakeCase(page.title) %>"
              name="<%= snakeCase(page.title) %>"
            >#<%= tag -%></a>
          </h2>

          <% if (pageCount > 1) { -%>
            <p>
              (Page <%= pageNum %> of <%= pageCount %>)
            </p>
          <% } -%>

          <p>
            Assorted journal entries with the tag <em>#<%= tag %></em>.
          </p>

          <hr class="feedLine">

          <p>
    <% } -%>

    <% if (content && Array.isArray(entriesToList)) { -%>
        <% entriesToList.forEach((page) => { -%>
            <article class="update journal h-entry js-update">

                <div class="p-author author h-card vcard authorHidden">

                  <% if (page.author && page.author.site && page.author.name) { -%>

                    <% if (page.author.photo) { -%>
                      <a href="<%= page.author.site %>"><img class="u-photo" src="<%= page.author.photo %>"></a>
                    <% } -%>

                    <a class="p-name fn u-url url" rel="author" href="<%= page.author.site %>"><%= page.author.name %></a>

                  <% } else if (site.author && site.author.site && site.author.name) { -%>

                    <% if (site.author.photo) { -%>
                      <a href="<%= site.author.site %>"><img class="u-photo" src="<%= site.author.photo %>"></a>
                    <% } -%>

                    <a class="p-name fn u-url url" rel="author" href="<%= site.author.site %>"><%= site.author.name %></a>

                  <% } -%>

                </div>

                <h3 id="<%= snakeCase(page.title) %>" >
                  <a class="p-name u-url" href="/<%= page.path %>"><%= page.title %></a>
                </h3>

                <% if (page.tldr || page.description) { -%>
                  <p><i>TL;DR &mdash; <%- page.tldr || page.description %></i></p>
                <% } -%>

                <% if (page.readTime) { -%>
                  <p class="journal readTime">
                    <span class="icon glasses-icon">&#x1f453;</span> <%= page.readTime %>
                  </p>                  
                <% } -%>
                
                <% if (page.content) { -%>
                  <div class="e-content">
                    <%- page.content %>
                  </div>
                <% } -%>

                <footer class="update-footer clearfix">

                  <% if (Array.isArray(page?.tags) && page.tags.length) { -%>

                    <div class="update-tags">
                  
                      <span class="icon folder-icon">&#x1f4c1;</span>
                  
                      <% page.tags.forEach((tag, index) => { -%>
                        <%= index > 0 ? ' / ' : '' %>
                        <a href="/journal/tags/<%= tag %>/index.html">
                          #<span class="p-category category"><%= tag %></span>
                        </a>
                      <% }) -%>
                  
                    </div>
                  
                  <% } -%>

                  <!--
                    <span class="update-citation">[iew.us q/1g0k2]
                      <a class="u-shortlink" type="text/html" rel="shortlink" href="https://iew.us/q/1g0k2">&#128279;</a>
                    </span>
                  -->

                  <a rel="bookmark" href="/<%= page.path %>" class="u-url update-footer-link update-footer-time">
                    <time datetime="<%= page.date_pub %>"
                      class="dt-published published js-pubDate pubDate"
                      ><%= prettyDate(page.date_pub) %></time>
                  </a>
                </footer>

              </article>

              <p class="backLink">
                <a class="backLink-link" href="#top">Top</a>
              </p>
              <hr class="feedLine">

        <% }) -%>

    <% } -%>

    <%- include('partials/pageMenu') %>

<!-- END TAG PAGE -->

        </div>
    </main>

<%- include('partials/journal/menusub') %>

<%- include('partials/bio') %>

<%- include('partials/footer') %>

</div>

<%- include('partials/bottom') %>
