github.com/elves/elvish@v0.15.0/website/template.html (about)

     1  <!doctype html>
     2  <html lang="en">
     3  <head>
     4    <meta charset="utf-8">
     5    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     6    {{ if is "homepage" }}
     7      <link rel="alternate" type="application/atom+xml"
     8            href="{{ rootURL }}/feed.atom">
     9    {{ end }}
    10  
    11    <title>
    12      {{ if is "homepage" }}
    13        {{ .BlogTitle }}
    14      {{ else if is "category" }}
    15        {{ index .CategoryMap .Category }}
    16      {{ else }}
    17        {{ .Title }}
    18      {{ end }}
    19    </title>
    20  
    21    <!-- Generated by realfavicongenerator.net -->
    22    <link rel="apple-touch-icon" sizes="180x180" href="{{ rootURL }}/apple-touch-icon.png">
    23    <link rel="icon" type="image/png" sizes="32x32" href="{{ rootURL }}/favicon-32x32.png">
    24    <link rel="icon" type="image/png" sizes="16x16" href="{{ rootURL }}/favicon-16x16.png">
    25    <link rel="manifest" href="{{ rootURL }}/site.webmanifest">
    26    <link rel="mask-icon" href="{{ rootURL }}/safari-pinned-tab.svg" color="#55bb55">
    27    <meta name="msapplication-TileColor" content="#da532c">
    28    <meta name="theme-color" content="#ffffff">
    29  
    30    <link rel="stylesheet" href="{{ rootURL }}/fonts.css"/>
    31  
    32    <style>
    33      {{ .BaseCSS }}
    34      {{ .ExtraCSS }}
    35    </style>
    36  
    37    <script>
    38      {{ .ExtraJS }}
    39    </script>
    40  </head>
    41  
    42  <body>
    43    <div id="navbar-container"> <div id="navbar">
    44      <div id="blog-title">
    45        <code>
    46          <a href="{{ rootURL }}/">
    47            elvish
    48          </a>
    49        </code>
    50      </div>
    51      <ul id="nav-list">
    52        {{ $homepageTitle := .HomepageTitle }}
    53        {{ $curcat := .Category }}
    54        {{ range $i, $info := .Categories }}
    55          <li class="nav-item">
    56            <a href="{{ rootURL }}/{{ $info.Name }}/"
    57               class="nav-link {{ if eq $curcat $info.Name}}current{{ end }}">
    58              <code>
    59                {{ $info.Name }}
    60              </code>
    61            </a>
    62          </li>
    63        {{ end }}
    64      </ul>
    65      <div class="clear"></div>
    66    </div> </div>
    67  
    68    {{/*
    69      The reference to "content" is a free one and has to be fixed elsewhere.
    70      The *-content templates defined below are intended to be used for this.
    71  
    72      For instance, by adding the following code, this whole template file will
    73      function as the template for articles:
    74  
    75          {{ define "content" }} {{ template "article-content" . }} {{ end }}
    76  
    77      This snippet can be generated by contentIs("article").
    78    */}}
    79    {{ template "content" . }}
    80  
    81    <script>
    82      // If the domain starts with "dark.", trigger dark mode.
    83      if (location.hostname.startsWith('dark.')) {
    84        document.body.classList.add('dark');
    85      }
    86  
    87      // Pressing d triggers dark mode. This is useful for debugging.
    88      window.addEventListener('keypress', function(ev) {
    89        if (String.fromCodePoint(ev.keyCode || ev.charCode) == 'd') {
    90          document.body.classList.toggle('dark');
    91        }
    92      });
    93  
    94      // If viewing locally, append index.html to relative paths that point to
    95      // directories
    96      if (location.protocol === 'file:') {
    97        var links = document.getElementsByTagName('a');
    98        for (var i = 0; i < links.length; i++) {
    99          var href = links[i].getAttribute('href');
   100          if (href && !href.match(/^https?:/) && href.endsWith('/')) {
   101            links[i].href = href + 'index.html';
   102          }
   103        }
   104      }
   105    </script>
   106  </body>
   107  </html>
   108  
   109  {{ define "article-content" }}
   110    <div id="content">
   111      <article class="article">
   112        {{ if not .IsHomepage }}
   113          <div class="article-title">
   114            <div class="timestamp"> {{ .Timestamp }} </div>
   115            <h1> {{ .Title }} </h1>
   116            <div class="clear"></div>
   117          </div>
   118        {{ end }}
   119        <div class="article-content">
   120          {{ .Content }}
   121        </div>
   122        <div class="clear"></div>
   123      </article>
   124    </div>
   125  {{ end }}
   126  
   127  {{ define "category-content" }}
   128    {{ $category := .Category }}
   129    <div id="content">
   130      {{ if ne .Prelude "" }}
   131        <div class="category-prelude article">
   132          <article class="article">
   133            {{ .Prelude }}
   134          </article>
   135        </div>
   136      {{ end }}
   137      <ul class="article-list">
   138        {{ range $article := .Articles }}
   139          <li>
   140            <a href="{{ rootURL }}/{{ $category }}/{{ $article.Name }}.html"
   141               class="article-link">{{ $article.Title }}</a>
   142            <span class="article-timestamp">
   143              {{ $article.Timestamp }}
   144            </span>
   145            <div class="clear"></div>
   146          </li>
   147        {{ end }}
   148      </ul>
   149    </div>
   150  {{ end }}