diff options
Diffstat (limited to 'layouts/_partials')
-rw-r--r-- | layouts/_partials/footer.gmi | 1 | ||||
-rw-r--r-- | layouts/_partials/footer.html | 3 | ||||
-rw-r--r-- | layouts/_partials/head.html | 22 | ||||
-rw-r--r-- | layouts/_partials/header.gmi | 3 | ||||
-rw-r--r-- | layouts/_partials/header.html | 5 | ||||
-rw-r--r-- | layouts/_partials/metadata.gmi | 2 | ||||
-rw-r--r-- | layouts/_partials/metadata.html | 6 | ||||
-rw-r--r-- | layouts/_partials/pageinfo.gmi | 18 | ||||
-rw-r--r-- | layouts/_partials/pageinfo.html | 23 |
9 files changed, 83 insertions, 0 deletions
diff --git a/layouts/_partials/footer.gmi b/layouts/_partials/footer.gmi new file mode 100644 index 0000000..06b0678 --- /dev/null +++ b/layouts/_partials/footer.gmi @@ -0,0 +1 @@ +{{ replace $.Site.Copyright "{currentYear}" (now.Format "2006") }}
\ No newline at end of file diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html new file mode 100644 index 0000000..5f8ffc6 --- /dev/null +++ b/layouts/_partials/footer.html @@ -0,0 +1,3 @@ +<footer class="footer"> + <p class="footer__text">{{ replace $.Site.Copyright "{currentYear}" (now.Format "2006") }}</p> +</footer>
\ No newline at end of file diff --git a/layouts/_partials/head.html b/layouts/_partials/head.html new file mode 100644 index 0000000..8250e19 --- /dev/null +++ b/layouts/_partials/head.html @@ -0,0 +1,22 @@ +<head> + <meta charset="utf-8"> + <meta name="theme-color" content="#000"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + {{- if $.Site.Params.description }} + <meta name="description" content="{{ $.Site.Params.description }}"> + {{- end -}} + {{ if $.Site.Params.keywords }} + <meta name="keywords" content="{{ $.Site.Params.keywords }}"> + {{- end -}} + {{ if .Site.Params.custom_css -}} + {{ range .Site.Params.custom_css }} + <link rel="stylesheet" type="text/css" href="{{ relURL . }}"> + {{- end -}} + {{ else }} + <link rel="stylesheet" type="text/css" href="{{ (resources.Get "static/css/style.css").RelPermalink }}"> + {{- end -}} + {{ if (not (fileExists "static/favicon.ico")) }} + <link rel="icon" href="data:,"> + {{- end }} + <title>{{ .Title }}</title> +</head>
\ No newline at end of file diff --git a/layouts/_partials/header.gmi b/layouts/_partials/header.gmi new file mode 100644 index 0000000..c70f84a --- /dev/null +++ b/layouts/_partials/header.gmi @@ -0,0 +1,3 @@ +```plaintext +{{ chomp (readFile "templates/logo.txt") }} +```
\ No newline at end of file diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html new file mode 100644 index 0000000..d8ec881 --- /dev/null +++ b/layouts/_partials/header.html @@ -0,0 +1,5 @@ +<header class="logo"> +<pre class="logo__text"> +{{ chomp (readFile "templates/logo.txt") }} +</pre> +</header>
\ No newline at end of file diff --git a/layouts/_partials/metadata.gmi b/layouts/_partials/metadata.gmi new file mode 100644 index 0000000..48d3db4 --- /dev/null +++ b/layouts/_partials/metadata.gmi @@ -0,0 +1,2 @@ +{{ partial "pageinfo.gmi" . }} +=> {{ .RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ .Title }}
\ No newline at end of file diff --git a/layouts/_partials/metadata.html b/layouts/_partials/metadata.html new file mode 100644 index 0000000..ed091b8 --- /dev/null +++ b/layouts/_partials/metadata.html @@ -0,0 +1,6 @@ +<article> + <header> + <p>{{ partial "pageinfo.html" . }}<br> + {{ emojify ":link:" }} <a class="link link--internal" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></p> + </header> +</article>
\ No newline at end of file diff --git a/layouts/_partials/pageinfo.gmi b/layouts/_partials/pageinfo.gmi new file mode 100644 index 0000000..9993d93 --- /dev/null +++ b/layouts/_partials/pageinfo.gmi @@ -0,0 +1,18 @@ +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} + +{{ $nonBreakingPublishDate := .Page.PublishDate | time.Format $dateFormat -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate " " " " -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "‑" -}} + +{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " " " -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "‑" -}} + +{{ $nonBreakingTags := slice -}} +{{ range .Param (lower (i18n "tags")) -}} + {{ $nonBreakingTag := replace . " " " " -}} + {{ $nonBreakingTag = replace $nonBreakingTag "-" "‑" -}} + {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} +{{ end -}} + +{{ emojify ":calendar:" }} {{ $nonBreakingPublishDate }} | {{ emojify ":stopwatch:" }} {{ $nonBreakingReadingTime }}{{ if $nonBreakingTags }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }}
\ No newline at end of file diff --git a/layouts/_partials/pageinfo.html b/layouts/_partials/pageinfo.html new file mode 100644 index 0000000..3ca8fe9 --- /dev/null +++ b/layouts/_partials/pageinfo.html @@ -0,0 +1,23 @@ +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} + +{{/* user-overridable parameter $dateFormat is escaped pre-insertion so that HTML entities can be inserted */ -}} +{{ $nonBreakingPublishDate := .Page.PublishDate | time.Format $dateFormat | htmlEscape -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate " " " " -}} +{{ $nonBreakingPublishDate = replace $nonBreakingPublishDate "-" "‑" -}} + +{{/* user-overridable parameter $readingTime is escaped pre-insertion so that HTML entities can be inserted */ -}} +{{ $nonBreakingReadingTime := i18n "readingTime" .ReadingTime | htmlEscape -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime " " " " -}} +{{ $nonBreakingReadingTime = replace $nonBreakingReadingTime "-" "‑" -}} + +{{ $breakingTags := .Param (lower (i18n "tags")) -}} +{{ $nonBreakingTags := slice -}} +{{ range $breakingTags -}} + {{/* user-defined tags are escaped pre-insertion so that HTML entities can be inserted */ -}} + {{ $nonBreakingTag := htmlEscape . -}} + {{ $nonBreakingTag = replace $nonBreakingTag " " " " -}} + {{ $nonBreakingTag = replace $nonBreakingTag "-" "‑" -}} + {{ $nonBreakingTags = $nonBreakingTags | append $nonBreakingTag -}} +{{ end -}} + +{{ emojify ":calendar:" }} <time {{ printf "datetime=%q" (.Page.PublishDate | time.Format "2006-01-02T15:04:05-0700") | safeHTMLAttr }}>{{ $nonBreakingPublishDate | safeHTML }}</time> | {{ emojify ":stopwatch:" }} <time datetime="PT{{ .ReadingTime }}M">{{ $nonBreakingReadingTime | safeHTML }}</time>{{ if $nonBreakingTags }} | {{ emojify ":label:" }} {{ end }}{{ range $key, $val := $nonBreakingTags }}{{ if $key }} {{ end }}<a class="link link--internal" href='{{ relLangURL (lower (i18n "tags")) }}/{{ index $breakingTags $key | urlize }}/' rel="noreferrer">{{ $val | safeHTML }}</a>{{ end }} |