From 6335137d45a3d91b4fffc1404be0c3baa030f8e0 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Sun, 1 Aug 2021 13:37:49 +0200 Subject: [PATCH] some theme tweaks --- assets/css/style.css | 88 ++++++++++++++++++++++++++++++++++++ layouts/_default/baseof.html | 12 +++-- layouts/_default/single.html | 46 +++++++++++++++---- layouts/partials/footer.html | 1 + static/css/style.css | 11 ----- 5 files changed, 136 insertions(+), 22 deletions(-) create mode 100644 assets/css/style.css delete mode 100644 static/css/style.css diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..2b8679e --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,88 @@ +html { + overflow-y: scroll +} + +:root { + --bgcolor: white; + --fontcolor: #444; + --linkcolor: #00e; + --visitedcolor: #551a8b; + --precolor: #fff; + --prebgcolor: #000; +} + +@media (prefers-color-scheme: dark) { + :root { + --bgcolor: black; + --fontcolor: white; + --linkcolor: #5bf; + --visitedcolor: #ae5ee0; + --precolor: #fff; + --prebgcolor: #383838; + } +} + +body { + max-width: 800px; + margin: 40px auto; + padding: 0 10px; + font: 14px/1.5 monospace; + color: var(--fontcolor); + background: var(--bgcolor) +} + +a:link { + color: var(--linkcolor) +} + +a:visited { + color: var(--visitedcolor) +} + +a:active { + color: var(--visitedcolor) +} + +h1,h2,h3 { + line-height: 1.2 +} + +p > code { + color: var(--precolor); + background: var(--prebgcolor); + padding: 2px +} + +pre { + color: var(--precolor); + background: var(--prebgcolor); + padding: 24px; + overflow-x: auto +} + +article { + padding: .5em 0 +} + +.center { + display: block; + margin-left: auto; + margin-right: auto; + width: 100%; +} + +img { + display: block; + max-width: 100%; + height: auto; +} + +figcaption { + color: #888; + font: 12px/1.5 monospace; + text-align: center; +} + +figure { + margin: auto +} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 926c1f5..f218f8a 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -8,9 +8,15 @@ {{ .Title }} {{ with .Site.Params.description }}{{ end }} {{ with .Site.Params.author }}{{ end }} - - {{ range .Site.Params.customCSS -}} - + + {{ $style := (resources.Get "css/style.css" | resources.Minify) }} + + + {{ range .Site.Params.customCSS -}} + {{- end }} {{ with .OutputFormats.Get "RSS" -}} {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b334487..93388d5 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,14 +2,44 @@

{{ .Title }}

- - {{ range .Params.tags }} - {{ . }} - {{ end }} - -
- {{ .Content }} -
+ {{ if or .Date .Params.tags .Params.categories }} +

+ + Posted + {{ if .Date }} + on + {{ end }} + {{ with .Params.categories }} + in + {{ range first 1 . }} + {{ . }} + {{- end -}} + {{- range after 1 . -}} + , {{ . }} + {{- end -}} + {{ end }} + + {{ with .WordCount }} + • {{ . }} words + {{ end }} + {{ with .ReadingTime }} + • {{ . }} minute read + {{ end }} + {{ with .Params.tags }} +
+ Tags: + {{ range first 1 . }} + {{ . }} + {{- end -}} + {{- range after 1 . -}} + , {{ . }} + {{- end -}} + {{ end }} +

+ {{ end }} +
+ {{ .Content }} +
{{ partial "sidebar.html" . }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 8ba9f44..119a2b8 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -3,5 +3,6 @@ {{- range .Site.Menus.footer }} {{ .Name }}. {{- end }} + {{ with .OutputFormats.Get "RSS" }}RSS.{{ end }}

diff --git a/static/css/style.css b/static/css/style.css deleted file mode 100644 index ce0019f..0000000 --- a/static/css/style.css +++ /dev/null @@ -1,11 +0,0 @@ -html {overflow-y: scroll} -:root { --bgcolor: white; --fontcolor: #444; --linkcolor: #00e; --visitedcolor: #551a8b; --precolor: #fff; --prebgcolor: #000;} -@media (prefers-color-scheme: dark) { :root { --bgcolor: black; --fontcolor: white; --linkcolor: #5bf; --visitedcolor: #ae5ee0; --precolor: #fff; --prebgcolor: #383838;}} -body{max-width:800px;margin:40px auto;padding:0 10px;font:14px/1.5 monospace;color:var(--fontcolor); background: var(--bgcolor)}a:link{color: var(--linkcolor)}a:visited{color: var(--visitedcolor)}a:active{color: var(--visitedcolor)}h1,h2,h3{line-height:1.2} -p > code{color: var(--precolor); background: var(--prebgcolor); padding:2px} -pre{color: var(--precolor); background: var(--prebgcolor); padding:24px; overflow-x: auto} -article{padding:24px 0} -.center {display: block;margin-left: auto;margin-right: auto;width: 100%;} -img {display: block; max-width: 100%; height: auto;} -figcaption {color: #888; font: 12px/1.5 monospace; text-align: center;} -figure {margin: auto}