summaryrefslogtreecommitdiff
path: root/site.tmpl
blob: 28175b5102efbcb2a858beb50038db03276241e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{{define "head" -}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{if eq .OutputPath "about/index.html"}}About &amp; colophon{{else}}{{.Title}}{{end}} — tjp.lol</title>
{{with index .Meta "description" -}}
<meta name="description" content="{{.}}">
{{end -}}
<link rel="stylesheet" href="{{rel .OutputPath "style.css"}}">
{{if eq (printf "%.7s" .URL) "/weblog" -}}
<link rel="alternate" type="application/atom+xml" title="tjp.lol" href="{{rel .OutputPath "feed.xml"}}">
{{end -}}
</head>
<body>
<div class="wrap">
{{end}}

{{define "header" -}}
  <header class="site">
    <h1 class="brand"><a href="{{rel .OutputPath "/"}}">~tjp<span class="cur"> $_</span></a></h1>
    {{if eq .OutputPath "index.html" -}}
    <p class="tag">Elder millennial in Salt Lake City, Utah.</p>
    {{end -}}
    <nav class="main">
      <a href="{{rel .OutputPath "/about/"}}"{{if eq .OutputPath "about/index.html"}} aria-current="page"{{end}}>about</a>
      <a href="{{rel .OutputPath "/weblog/"}}"{{if eq .OutputPath "weblog/index.html"}} aria-current="page"{{end}}>weblog</a>
      <a href="{{rel .OutputPath "/notes/"}}"{{if eq .OutputPath "notes/index.html"}} aria-current="page"{{end}}>notes</a>
      <a href="{{rel .OutputPath "/projects/"}}"{{if eq .OutputPath "projects/index.html"}} aria-current="page"{{end}}>projects</a>
      <a href="{{rel .OutputPath "/feed.xml"}}">feed</a>
    </nav>
  </header>
{{end}}

{{define "footer" -}}
  <footer>
    <!-- <div class="ring">
      <span>webring:</span>
      <a href="#">&larr; prev</a><a href="#">rand</a><a href="#">next &rarr;</a>
    </div> -->
    <p>&copy;2026 tjp &middot; content <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a> unless noted &middot; <a href="{{rel .OutputPath "feed.xml"}}">feed</a></p>
  </footer>

</div>
</body>
</html>
{{end}}

{{define "page" -}}
{{template "head" .}}
{{template "header" .}}
  <main>
    <article class="post">
      <div class="note-body">
        {{joinSections .Sections}}
      </div>
    </article>
  </main>

{{template "footer" .}}
{{end}}

{{define "weblog" -}}
{{template "head" .}}
{{template "header" .}}
  {{$post_date := or (index .Meta "post_date") .ModTime -}}
  <main>
    <article class="post">
      <div class="post-head">
        <p class="meta"><a href="{{rel .OutputPath "weblog/index.html"}}" style="text-decoration:none;">&larr; weblog</a> &nbsp;/&nbsp; <time datetime="{{date $post_date "2006-01-02"}}">{{date $post_date "2006-01-02"}}</time></p>
      </div>

      {{- $sawH1 := false}}
      {{- $lede := true}}
      {{- range .Sections}}
        {{- if and $sawH1 $lede -}}
<div style="font-size:1.2em">{{.}}</div>
          {{- $lede = false}}
        {{- else}}
          {{- .}}
          {{- if eq (printf "%.3s" .) "<h1"}}
            {{- $sawH1 = true}}
          {{- end}}
        {{- end}}
      {{- end}}
    </article>

    <nav class="post-nav">
      <a href="{{rel .OutputPath "weblog/index.html"}}">All posts</a>
    </nav>
  </main>

{{template "footer" .}}
{{end}}

{{define "notes" -}}
{{template "head" .}}
{{template "header" .}}
  <main>
    <article class="post">
      <div class="post-head">
        <p class="meta"><a href="{{rel .OutputPath "notes/index.html"}}" style="text-decoration:none;">&larr; notes</a></p>
      </div>

      <div class="note-body">
        {{joinSections .Sections}}
      </div>
    </article>
  </main>

{{template "footer" .}}
{{end}}