<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  {{ if is "homepage" }}
    <link rel="alternate" type="application/atom+xml"
          href="{{ rootURL }}/feed.atom">
  {{ end }}

  <title>
    {{ if is "homepage" }}
      {{ .BlogTitle }}
    {{ else if is "category" }}
      {{ index .CategoryMap .Category }}
    {{ else }}
      {{ .Title }}
    {{ end }}
  </title>

  <!-- Generated by realfavicongenerator.net -->
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
  <link rel="manifest" href="/manifest.json">
  <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#55bb55">
  <meta name="theme-color" content="#ffffff">

  <link href="/assets/genblog.css" rel="stylesheet">
  <link href="/assets/elvish.css" rel="stylesheet">
</head>

<body>
  <div id="navbar-container"> <div id="navbar">
    <div id="blog-title">
      <code>
        <a href="/">~&gt;</a>
        <a href="/download" class="command">elvish</a>
      </code>
    </div>
    <ul id="category-list">
      {{ $homepageTitle := .HomepageTitle }}
      {{ $curcat := .Category }}
      <li class="{{ if eq $curcat "homepage" }}current{{ end }}">
        <a href="{{ rootURL }}" class="nav-link">
          {{ $homepageTitle }}
        </a>
      </li>
      {{ range $info := .Categories }}
        <li class="{{ if eq $curcat $info.Name}}current{{ end }}">
          <a href="{{ rootURL }}/{{ $info.Name }}/" class="nav-link">
            {{ $info.Title }}
          </a>
        </li>
      {{ end }}
    </ul>
    <div class="clear"></div>
  </div> </div>

  {{/*
    The reference to "content" is a free one and has to be fixed elsewhere.
    The *-content templates defined below are intended to be used for this.

    For instance, by adding the following code, this whole template file will
    function as the template for articles:

        {{ define "content" }} {{ template "article-content" . }} {{ end }}

    This snippet can be generated by contentIs("article").
  */}}
  {{ template "content" . }}
</body>
</html>

{{ define "article-content" }}
  <div class="card">
    <article class="article">
      {{ if not .IsHomepage }}
        <div class="article-header">
          <div class="timestamp"> {{ .Timestamp }} </div>
          <h1> {{ .Title }} </h1>
          <div class="clear"></div>
        </div>
        <div class="card-splitter"></div>
      {{ end }}
      <div class="article-content">
        {{ .Content }}
      </div>
      <div class="clear"></div>
    </article>
  </div>
{{ end }}

{{ define "category-content" }}
  {{ $category := .Category }}
  <div class="card">
    {{ if ne .Prelude "" }}
      <div class="category-prelude article">
        <article class="article">
          {{ .Prelude }}
        </article>
      </div>
    {{ end }}
    <ul class="article-list">
      {{ range $article := .Articles }}
        <li>
          <a href="{{ rootURL }}/{{ $category }}/{{ $article.Name }}.html"
             class="nav-link">{{ $article.Title }}</a>
          <span class="article-timestamp">
            {{ $article.Timestamp }}
          </span>
          <div class="clear"></div>
        </li>
      {{ end }}
    </ul>
  </div>
{{ end }}
