diff options
Diffstat (limited to 'srv/src/tpl')
-rw-r--r-- | srv/src/tpl/html/base.html | 65 | ||||
-rw-r--r-- | srv/src/tpl/html/post.html | 48 | ||||
-rw-r--r-- | srv/src/tpl/tpl.go | 12 |
3 files changed, 125 insertions, 0 deletions
diff --git a/srv/src/tpl/html/base.html b/srv/src/tpl/html/base.html new file mode 100644 index 0000000..bf81032 --- /dev/null +++ b/srv/src/tpl/html/base.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<html lang="en"> + + <head> + <meta charset="utf-8"> + <link rel="stylesheet" href="/assets/normalize.css"> + <link rel="stylesheet" href="/assets/skeleton.css"> + <link rel="stylesheet" href="/assets/friendly.css"> + <link rel="stylesheet" href="/assets/main.css"> + <link rel="stylesheet" href="/assets/fontawesome/css/all.css"> + </head> + + <body> + + <div class="container"> + + <header id="title-header" role="banner"> + <div class="row"> + <div class="seven columns" style="margin-bottom: 3rem;"> + <h1 class="title"> + <a href="/">Mediocre Blog</a> + </h1> + <div class="light social"> + <span>By Brian Picciano</span> + <span> + Even more @ + <a href="https://mediocregopher.eth.link" target="_blank">https://mediocregopher.eth.link</a> + </span> + </div> + </div> + + <div class="five columns light"> + <span style="display:block; margin-bottom:0.5rem;">Get notified when new posts are published!</span> + <a href="/follow.html"> + <button class="button-primary"> + <i class="far fa-envelope"></i> + Follow + </button> + </a> + <a href="/feed.xml"> + <button class="button"> + <i class="fas fa-rss"></i> + RSS + </button> + </a> + </div> + + </div> + </header> + + {{ template "body" . }} + + <footer> + <p class="license light"> + Unless otherwised specified, all works are licensed under the + <a href="/assets/wtfpl.txt">WTFPL</a>. + </p> + </footer> + + </div> + + </body> + +</html> + diff --git a/srv/src/tpl/html/post.html b/srv/src/tpl/html/post.html new file mode 100644 index 0000000..22a5b97 --- /dev/null +++ b/srv/src/tpl/html/post.html @@ -0,0 +1,48 @@ +{{ define "body" }} + +<header id="post-header"> + <h1 id="post-headline"> + {{ .Title }} + </h1> + <div class="light"> + {{ .PublishedAt.Format "2006-01-02" }} + • + {{ if not .LastUpdatedAt.IsZero }} + (Updated {{ .LastUpdatedAt.Format "2006-01-02" }}) + • + {{ end }} + <em>{{ .Description }}</em> + </div> +</header> + +{{ if (or .SeriesPrevious .SeriesNext) }} +<p class="light"><em> + This post is part of a series:<br/> + {{ if .SeriesPrevious }} + Previously: <a href="{{ .SeriesPrevious.HTTPPath }}">{{ .SeriesPrevious.Title }}</a></br> + {{ end }} + {{ if .SeriesNext }} + Next: <a href="{{ .SeriesNext.HTTPPath }}">{{ .SeriesNext.Title }}</a></br> + {{ end }} +</em></p> +{{ end }} + +<div id="post-content"> + {{ .Body }} +</div> + +{{ if (or .SeriesPrevious .SeriesNext) }} +<p class="light"><em> + If you liked this post, consider checking out other posts in the series:<br/> + {{ if .SeriesPrevious }} + Previously: <a href="{{ .SeriesPrevious.HTTPPath }}">{{ .SeriesPrevious.Title }}</a></br> + {{ end }} + {{ if .SeriesNext }} + Next: <a href="{{ .SeriesNext.HTTPPath }}">{{ .SeriesNext.Title }}</a></br> + {{ end }} +</em></p> +{{ end }} + +{{ end }} + +{{ template "base.html" . }} diff --git a/srv/src/tpl/tpl.go b/srv/src/tpl/tpl.go new file mode 100644 index 0000000..1dd98ba --- /dev/null +++ b/srv/src/tpl/tpl.go @@ -0,0 +1,12 @@ +// Package tpl contains template files which are used to render the blog. +package tpl + +import ( + "embed" + html_tpl "html/template" +) + +//go:embed * +var fs embed.FS + +var HTML = html_tpl.Must(html_tpl.ParseFS(fs, "html/*")) |