diff options
Diffstat (limited to 'site.tmpl')
| -rw-r--r-- | site.tmpl | 71 |
1 files changed, 48 insertions, 23 deletions
@@ -1,21 +1,29 @@ -{{define "head"}}<!DOCTYPE html> +{{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 & 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 or (eq .OutputPath "weblog/index.html") (index .Meta "post_date")}}<link rel="alternate" type="application/atom+xml" title="tjp.lol" href="{{rel .OutputPath "feed.xml"}}"> -{{end}}</head> +{{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"> +{{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"> + {{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> @@ -25,7 +33,8 @@ </header> {{end}} -{{define "footer"}} <footer> +{{define "footer" -}} + <footer> <!-- <div class="ring"> <span>webring:</span> <a href="#">← prev</a><a href="#">rand</a><a href="#">next →</a> @@ -38,30 +47,43 @@ </html> {{end}} -{{define "page"}}{{template "head" .}}{{template "header" .}} +{{define "page" -}} +{{template "head" .}} +{{template "header" .}} <main> <article class="post"> - <div class="post-head"> - <h1>{{.Title}}</h1> - </div> <div class="note-body"> {{joinSections .Sections}} </div> </article> </main> -{{template "footer" .}}{{end}} +{{template "footer" .}} +{{end}} -{{define "weblog"}}{{template "head" .}}{{template "header" .}} +{{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;">← weblog</a> / <time datetime="{{date (index .Meta "post_date") "2006-01-02"}}">{{date (index .Meta "post_date") "2006-01-02"}}</time></p> - <h1>{{.Title}}</h1> + <p class="meta"><a href="{{rel .OutputPath "weblog/index.html"}}" style="text-decoration:none;">← weblog</a> / <time datetime="{{date $post_date "2006-01-02"}}">{{date $post_date "2006-01-02"}}</time></p> </div> - {{with .Sections}}{{with index . 0}}<div style="font-size:1.2em">{{.}}</div>{{end}} - {{joinSections (slice . 1)}}{{end}} + {{- $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"> @@ -69,14 +91,16 @@ </nav> </main> -{{template "footer" .}}{{end}} +{{template "footer" .}} +{{end}} -{{define "notes"}}{{template "head" .}}{{template "header" .}} +{{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;">← notes</a></p> - <h1>{{.Title}}</h1> </div> <div class="note-body"> @@ -85,4 +109,5 @@ </article> </main> -{{template "footer" .}}{{end}} +{{template "footer" .}} +{{end}} |
