diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-08-16 01:21:02 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2022-08-16 01:21:02 +0200 |
commit | c0d248d18c4d2a8921ef59377c26382abbffe8c3 (patch) | |
tree | fa28596ff7a5f3dda63174ffa58b21ee81e99e79 /layouts | |
parent | accd771c040f2869e2e464d33cb90e70576ba7e1 (diff) |
Update hugo framework
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/list.html | 11 | ||||
-rw-r--r-- | layouts/_default/rss.xml | 26 | ||||
-rw-r--r-- | layouts/_default/single.html | 5 | ||||
-rw-r--r-- | layouts/index.html | 5 | ||||
-rw-r--r-- | layouts/partials/footer.html | 10 | ||||
-rw-r--r-- | layouts/partials/header.html | 21 | ||||
-rw-r--r-- | layouts/partials/nav.html | 8 | ||||
-rw-r--r-- | layouts/partials/nextprev.html | 10 | ||||
-rw-r--r-- | layouts/partials/taglist.html | 13 | ||||
-rw-r--r-- | layouts/shortcodes/hidvid.html | 10 | ||||
-rw-r--r-- | layouts/shortcodes/img.html | 22 | ||||
-rw-r--r-- | layouts/shortcodes/tagcloud.html | 3 | ||||
-rw-r--r-- | layouts/shortcodes/vid.html | 6 |
13 files changed, 150 insertions, 0 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..b6a63be --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,11 @@ +{{ partial "header.html" . -}} +<header><h1 id="tag_{{ .Title }}">{{ .Title | title }}</h1></header> +<article> +{{ .Content -}} +<ul> +{{- range.Pages }} + <li><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006 Jan 02" }}</time> – <a href="{{ .RelPermalink }}">{{ .Title }}</a></li> +{{ end -}} +</ul> +</article> +{{- partial "footer.html" . }} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..9269333 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,26 @@ +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ .Site.Title }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + {{ with .OutputFormats.Get "RSS" }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{ end }} + {{ range .Pages }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description>{{- .Content | html -}}</description> + </item> + {{ end }} + </channel> +</rss> diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..43e8c2a --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,5 @@ +{{ partial "header.html" . -}} +<header><h1>{{ .Title }}</h1></header> +<article> +{{ .Content -}} +{{ partial "footer.html" . }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..43e8c2a --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,5 @@ +{{ partial "header.html" . -}} +<header><h1>{{ .Title }}</h1></header> +<article> +{{ .Content -}} +{{ partial "footer.html" . }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..3d1282e --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,10 @@ +<!-- {{ partial "nextprev.html" . -}} --> +<!-- {{ partial "taglist.html" . -}} --> +</article> +</main> +<footer> + <a href="{{ .Site.BaseURL }}">{{ .Site.BaseURL }}</a><br><br> + <a href="/index.xml"><img src="/rss.svg" style="max-height:1.5em" alt="RSS Feed" title="Subscribe via RSS for updates."></a> +</footer> +</body> +</html> diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..f304fde --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html lang="{{ .Site.Language }}"> +<head> + <title>{{ if not .IsHome }}{{ .Title | title }} | {{ end }}{{ .Site.Title }}</title> + <link rel="canonical" href="{{ .Site.BaseURL }}"> + <link rel='alternate' type='application/rss+xml' title="{{ .Site.Title }} RSS" href='/index.xml'> + <link rel='stylesheet' type='text/css' href='/style.css'> + {{ with .Site.Params.favicon }}<link rel="icon" href="{{ . }}"> + {{ end -}} + <meta name="description" content="{{ with .Params.description }}{{ . }}{{ else }}{{ .Summary }}{{ end }}"> + {{ if isset .Params "tags" }}<meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}"> + {{ end -}} + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="robots" content="index, follow"> + <meta charset="utf-8"> +</head> +<body> +{{- if .Site.Menus.main }} +{{ partial "nav.html" . }} +{{ end }} +<main> diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html new file mode 100644 index 0000000..a7318fe --- /dev/null +++ b/layouts/partials/nav.html @@ -0,0 +1,8 @@ +<nav> + <ul> + {{- $sec := .Page.Section }}{{ $file := .File.TranslationBaseName -}} + {{ range.Site.Menus.main.ByWeight }}{{ $base := path.Base .URL }} + <li><a {{ if or ( eq $sec $base ) ( eq $file $base ) ( and (eq $sec "") ( eq $file "_index") (eq $base "/") ) }}class="menuactive" {{ end }}href="{{ .URL }}"><span class=pre>{{ .Pre }}</span><span class=menuname>{{ .Name }}</span></a></li> + {{- end }} + </ul> +</nav> diff --git a/layouts/partials/nextprev.html b/layouts/partials/nextprev.html new file mode 100644 index 0000000..099f16d --- /dev/null +++ b/layouts/partials/nextprev.html @@ -0,0 +1,10 @@ +{{ if or .Next .Prev -}} +<div id="nextprev"> +{{- with .Prev }} +<a href="{{ .RelPermalink}}"><div id="prevart">Previous:<br>{{.Title}}</div></a> +{{ end -}} +{{- with .Next -}} +<a href="{{ .RelPermalink}}"><div id="nextart">Next:<br>{{.Title}}</div></a> +{{ end -}} +</div> +{{ end -}} diff --git a/layouts/partials/taglist.html b/layouts/partials/taglist.html new file mode 100644 index 0000000..757db6f --- /dev/null +++ b/layouts/partials/taglist.html @@ -0,0 +1,13 @@ + {{- if isset .Params "tags" -}} + {{- $tagsLen := len .Params.tags -}} + {{- if gt $tagsLen 0 -}} + <div style="clear:both" class=taglist> + {{- with .Site.Params.relatedtext }}{{ . }}<br>{{ end -}} + {{- range $k, $v := .Params.tags -}} + {{- $url := printf "tags/%s" (. | urlize | lower) -}} + <a id="tag_{{ . | lower }}" href="{{ $url | absURL }}">{{ . | title }}</a> + {{- if lt $k (sub $tagsLen 1) }} · {{ end -}} + {{- end -}} + </div> + {{- end -}} + {{- end }} diff --git a/layouts/shortcodes/hidvid.html b/layouts/shortcodes/hidvid.html new file mode 100644 index 0000000..14f592d --- /dev/null +++ b/layouts/shortcodes/hidvid.html @@ -0,0 +1,10 @@ +<details> + <summary>Click to reveal video.</summary> +<iframe src="{{ index .Params 0 }}" + loading="lazy" + sandbox="allow-same-origin allow-scripts allow-popups" + allowfullscreen frameborder="0" + class="embvid" + title="Embedded Video"> +</iframe> +</details> diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html new file mode 100644 index 0000000..2df4ff6 --- /dev/null +++ b/layouts/shortcodes/img.html @@ -0,0 +1,22 @@ +<!-- + class: class of the figure + link: url the image directs to + alt: alternative text + caption: caption + mouse: what the image says when moused over ("title" in HTML) +--> +<figure {{ with .Get "class" }}class="{{.}}"{{ end -}}> + {{- with .Get "link"}}<a href="{{.}}">{{ end -}} + <img src="{{ .Get "src" }}" + {{- with .Get "mouse" }} title="{{.}}"{{ end -}} + {{- with .Get "alt" }} alt="{{.}}"{{ end -}} + {{- with .Get "width" }} width="{{.}}"{{ end -}} + {{- with .Get "style" }} style="{{.}}"{{ end -}} + > + {{- if .Get "link"}}</a>{{ end -}} + {{- with .Get "caption" -}} + <figcaption> + {{- . -}} + </figcaption> + {{- end -}} +</figure> diff --git a/layouts/shortcodes/tagcloud.html b/layouts/shortcodes/tagcloud.html new file mode 100644 index 0000000..0cf0118 --- /dev/null +++ b/layouts/shortcodes/tagcloud.html @@ -0,0 +1,3 @@ +{{ if isset .Site.Taxonomies "tags" }}{{ if not (eq (len .Site.Taxonomies.tags) 0) }} <ul id="tagcloud"> + {{ range $name, $items := .Site.Taxonomies.tags }}{{ $url := printf "%s/%s" "tags" ($name | urlize | lower)}}<li><a href="{{ $url | absURL }}" id="tag_{{ $name }}">{{ $name | title }}</a></li> + {{ end }}</ul>{{ end }}{{ end }} diff --git a/layouts/shortcodes/vid.html b/layouts/shortcodes/vid.html new file mode 100644 index 0000000..4c612fe --- /dev/null +++ b/layouts/shortcodes/vid.html @@ -0,0 +1,6 @@ +<iframe src="{{ index .Params 0 }}" + loading="lazy" + sandbox="allow-same-origin allow-scripts allow-popups" + allowfullscreen frameborder="0" + title="Embedded Video"> +</iframe> |