diff options
author | mms <michal@sapka.me> | 2024-04-26 22:40:29 +0200 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-04-26 22:40:58 +0200 |
commit | 2b72efd749c76b9c3d6a7a5bc310e6c6a530dea8 (patch) | |
tree | bd4c4a0b383c3302b0d2e294f500b614202fec12 /layouts | |
parent | 8107766380a121d50cb16c30e6df4db9f9e0d18e (diff) |
feat: tidy up
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/baseof.html | 58 | ||||
-rw-r--r-- | layouts/_default/list.html | 7 | ||||
-rw-r--r-- | layouts/_default/single.html | 44 | ||||
-rw-r--r-- | layouts/partials/footer/footer.html | 6 | ||||
-rw-r--r-- | layouts/partials/header/header.html | 16 | ||||
-rw-r--r-- | layouts/partials/header/meta.html | 37 | ||||
-rw-r--r-- | layouts/partials/menu.html | 6 | ||||
-rw-r--r-- | layouts/partials/single/dates.html | 24 |
8 files changed, 86 insertions, 112 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 6325675..e348fd5 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,55 +1,12 @@ <!DOCTYPE html> <html lang="en"> - <head> - <meta charset="utf-8"> - <title> - {{- block "title" . }} - [{{ .Site.Title}}] {{ .Page.Title }} - {{- end }} - </title> - <link rel='stylesheet' type='text/css' href='/style.css?v=4.0'> - <meta name="viewport" content="width=device-width, initial-scale=1"> - {{- $image := resources.Get "/icons/apple-touch-icon.png"}} - <link rel="apple-touch-icon" sizes="180x180" href="{{ $image.Permalink }}"> - {{- $image := resources.Get "/icons/favicon-32x32.png" }} - <link rel="icon" type="image/png" sizes="32x32" href="{{ $image.Permalink }}"> - {{- $image := resources.Get "/icons/favicon-16x16.png" }} - <link rel="icon" type="image/png" sizes="16x16" href="{{ $image.Permalink }}"> - <meta name="description" content="{{ .Params.Abstract | default .Site.Params.DefaultDescription}}"> + {{ partial "header/meta" . }} - <meta property="og:title" content="{{ .Page.Title }}"> - <meta property="og:type" content="website"> - <meta property="og:url" content="{{ .Permalink }}"> - {{- $imageUrl := default "logos/right.png" .Params.image }} - {{- $image := resources.Get $imageUrl }} - <meta property="og:image" content="{{ $image.Permalink }}"> - <meta property="og:description" content="{{ .Params.Abstract | default .Site.Params.DefaultDescription}}"> - - <meta name="twitter:title" content="{{ .Page.Title }}"> - <meta name="twitter:image" content="{{ $image.Permalink }}"> - <meta name="twitter:card" content="summary_large_image"> - <meta name="twitter:description" content="{{ .Params.Abstract | default .Site.Params.DefaultDescription}}" > - - <link rel="canonical" href="{{ .Permalink }}"> - <link rel='alternate' type='application/rss+xml' title="Feed with all changes" href='/index.xml'> - <link rel='alternate' type='application/rss+xml' title="Feed with Emacs changes" href='/emacs/rss.xml'> - <link rel='alternate' type='application/rss+xml' title="Feed with BSD changes" href='/bsd/rss.xml'> - <meta name="robots" content="index, follow"> - {{ if isset .Params "tags" }}<meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}">{{end}} - <link rel="me" href="https://emacs.ch/@mms"> - - <link href="https://github.com/michalsapka" rel="me"> - <link rel="webmention" href="https://webmention.io/d-s.sh/webmention"> - <link rel="pingback" href="https://webmention.io/d-s.sh/xmlrpc"> - </head> - {{ $section_class := "mms"}} {{ if in .Page.Params.categories "star-trek" }} {{ $section_class = "star-trek" }} {{ else if in .Page.Params.category "site-info" }} {{ $section_class = "site-info" }} - {{ else if in .Page.Params.categories "site" }} - {{ $section_class = "site-info" }} {{ else if in .Page.Params.categories "bsd" }} {{ $section_class = "bsd" }} {{ else if in .Page.Params.categories "blog" }} @@ -65,20 +22,9 @@ {{ partial "header/header" . }} <main class="right-column"> - - {{ block "main" . }} {{ end }} - - {{ block "pagination" . }} - {{ end }} - - <br><br> - </main> - <footer> - {{ partial "button-15" (dict "button" . "file" "home.gif" "alt" "Return to homepage" "href" "/") }} - {{ partial "button-15" (dict "button" . "file" "rss-20.gif" "alt" "RSS feed" "href" "/index.xml") }} - </footer> + {{ partial "footer/footer" . }} </body> </html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f106a52..ed81704 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,10 +2,11 @@ {{if .Page.Content}} {{ .Page.Content }} -{{- if .Params.primary_menu }} -{{ partial "single/bottom_nav.html" (dict "menuID" .Page.Params.primary_menu "page" .) }} -{{- end }} + {{- if .Params.primary_menu }} + {{ partial "single/bottom_nav.html" (dict "menuID" .Page.Params.primary_menu "page" .) }} + {{- end }} {{ else }} + {{ if in .Page.Params.Categories "blog" }} {{ partial "partials/blog_index.html" . }} {{ else if in .Page.Params.Categories "article" }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0ac881c..03b518f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,45 +1,13 @@ {{ define "main" }} - <article> - {{ .Page.Content }} - {{- if not (in .Params.category "pages") }} - {{- if not (eq .Page.Type "special") }} - {{ $pubdate := .PublishDate.Format "2006-01-02" }} - {{ $lastmod := .Lastmod.Format "2006-01-02" }} +<article> + {{ .Page.Content }} +</article> - {{ $file := .File.LogicalName }} - {{ $path := .File.Path }} - {{ $lastmodhash := .GitInfo.Hash }} +{{ partial "single/dates.html" . }} - <div class="publish-date"> - {{ if eq $pubdate $lastmod }} - Published: <time datetime="{{ $pubdate }}"> - <a href="{{$.Site.Params.repoUrl}}/commit/{{$lastmodhash}}">{{ $lastmod }}</a> - </time> - {{ else }} - Originally published: - <time datetime="{{ $pubdate }}">{{ $pubdate }}</time>; - updated: <time datetime="{{ $lastmod }}"> - <a href="{{$.Site.Params.repoUrl}}/commit/{{$lastmodhash}}">{{ $lastmod }}</a> - </time> - {{ end }} - - {{ partial "button-15" (dict "button" . "file" "email-me.png" "alt" "Email me" "href" "/me/contact/") }} - - {{- end }} - {{- end }} - </article> - - {{ if .Page.Params.hasnavsection }} - {{ with .NextInSection }} - ← <a href="{{ .RelPermalink }}">{{ or .Page.Params.shortname .Page.Name }}</a> - {{ end }} - <br> - {{ with .PrevInSection }} - <a href="{{ .RelPermalink }}">{{ or .Page.Params.shortname .Page.Name }}</a> → - {{ end }} - {{ end }} {{- if .Params.primary_menu }} -{{ partial "single/bottom_nav.html" (dict "menuID" .Page.Params.primary_menu "page" .) }} + {{ partial "single/bottom_nav.html" (dict "menuID" .Page.Params.primary_menu "page" .) }} {{- end }} + {{- end }} diff --git a/layouts/partials/footer/footer.html b/layouts/partials/footer/footer.html new file mode 100644 index 0000000..0fb4d82 --- /dev/null +++ b/layouts/partials/footer/footer.html @@ -0,0 +1,6 @@ +<br> +<footer> + {{ partial "button-15" (dict "button" . "file" "home.gif" "alt" "Return to homepage" "href" "/") }} + {{ partial "button-15" (dict "button" . "file" "rss-20.gif" "alt" "RSS feed" "href" "/index.xml") }} + {{ partial "button-15" (dict "button" . "file" "email-me.png" "alt" "Email me" "href" "/me/contact/") }} + </footer> diff --git a/layouts/partials/header/header.html b/layouts/partials/header/header.html index 08a3b24..05e9290 100644 --- a/layouts/partials/header/header.html +++ b/layouts/partials/header/header.html @@ -19,22 +19,14 @@ {{ $logo := resources.Get "logos/logo-brain.svg" }} <img src="{{$logo.Permalink}}" class="emacslogo" alt="Emacs"> {{ end }} + </a> </div> <div class="name"> <nav> - <ol> - {{- range .Ancestors.Reverse }} - {{- if .LinkTitle}} - <li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> - {{- end }} - {{- end }} - <li> - <h1> - <a aria-current="page" href="{{ .RelPermalink }}">{{ .Page.Title }}</a> - </h1> - </li> - </ol> + <h1> + <a aria-current="page" href="{{ .RelPermalink }}">{{ .Page.Title }}</a> + </h1> </nav> </div> </header> diff --git a/layouts/partials/header/meta.html b/layouts/partials/header/meta.html new file mode 100644 index 0000000..9d27e50 --- /dev/null +++ b/layouts/partials/header/meta.html @@ -0,0 +1,37 @@ +<head> + <meta charset="utf-8"> + <title> + {{- block "title" . }} + [{{ .Site.Title}}] {{ .Page.Title }} + {{- end }} + </title> + <link rel='stylesheet' type='text/css' href='/style.css?v=4.0'> + <meta name="viewport" content="width=device-width, initial-scale=1"> + {{- $image := resources.Get "/icons/apple-touch-icon.png"}} + <link rel="apple-touch-icon" sizes="180x180" href="{{ $image.Permalink }}"> + {{- $image := resources.Get "/icons/favicon-32x32.png" }} + <link rel="icon" type="image/png" sizes="32x32" href="{{ $image.Permalink }}"> + {{- $image := resources.Get "/icons/favicon-16x16.png" }} + <link rel="icon" type="image/png" sizes="16x16" href="{{ $image.Permalink }}"> + <meta name="description" content="{{ .Params.Abstract | default .Site.Params.DefaultDescription}}"> + + <meta property="og:title" content="{{ .Page.Title }}"> + <meta property="og:type" content="website"> + <meta property="og:url" content="{{ .Permalink }}"> + {{- $imageUrl := default "logos/right.png" .Params.image }} + {{- $image := resources.Get $imageUrl }} + <meta property="og:image" content="{{ $image.Permalink }}"> + <meta property="og:description" content="{{ .Params.Abstract | default .Site.Params.DefaultDescription}}"> + + <link rel="canonical" href="{{ .Permalink }}"> + <link rel='alternate' type='application/rss+xml' title="Feed with all changes" href='/index.xml'> + <link rel='alternate' type='application/rss+xml' title="Feed with Emacs changes" href='/emacs/rss.xml'> + <link rel='alternate' type='application/rss+xml' title="Feed with BSD changes" href='/bsd/rss.xml'> + <meta name="robots" content="index, follow"> + {{ if isset .Params "tags" }}<meta name="keywords" content="{{ with .Params.tags }}{{ delimit . ", " }}{{ end }}">{{end}} + <link rel="me" href="https://emacs.ch/@mms"> + + <link href="https://github.com/michalsapka" rel="me"> + <link rel="webmention" href="https://webmention.io/d-s.sh/webmention"> + <link rel="pingback" href="https://webmention.io/d-s.sh/xmlrpc"> +</head> diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 6f327ee..28421ac 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -14,11 +14,11 @@ {{- range .menuEntries }} {{- if .Params.nonpage }} - <li>{{.Name }} + <li>{{.Name }} {{ .Post }} {{- else if .Params.placeholder }} - <li><span class="placeholder">{{.Name }}</span> + <li><span class="placeholder">{{.Name }} {{ .Post }}</span> {{- else}} - <li><b><a href="{{ .URL }}">{{ .Name }}</a></b> + <li><b><a href="{{ .URL }}">{{ .Name }}</a></b> {{ .Post }} {{- partial "inline/menu/new-or-up.html" (dict "page" ($page.GetPage .URL)) }} {{- end}} diff --git a/layouts/partials/single/dates.html b/layouts/partials/single/dates.html new file mode 100644 index 0000000..080e37b --- /dev/null +++ b/layouts/partials/single/dates.html @@ -0,0 +1,24 @@ +{{ $pubdate := .PublishDate.Format "2006-01-02" }} +{{ $lastmod := .Lastmod.Format "2006-01-02" }} + +{{ $file := .File.LogicalName }} +{{ $path := .File.Path }} +{{ $lastmodhash := .GitInfo.Hash }} + +<aside class="publish-date"> + {{ if eq $pubdate $lastmod }} + + Published: <time datetime="{{ $pubdate }}"> + <a href="{{$.Site.Params.repoUrl}}/commit/{{$lastmodhash}}">{{ $lastmod }}</a> + </time> + {{ else }} + + Originally published: + + <time datetime="{{ $pubdate }}">{{ $pubdate }}</time>; + updated: <time datetime="{{ $lastmod }}"> + <a href="{{$.Site.Params.repoUrl}}/commit/{{$lastmodhash}}">{{ $lastmod }}</a> + </time> +</aside> + {{ end }} + |