From 3fb0ef35fe8c2965358c651ed5379e2760385e9e Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 11 Sep 2022 10:40:25 -0700 Subject: [PATCH] Update the blog list layout --- content/blog/blog.css | 86 ++++++++++++++++++++++++++++++++++++ layouts/_default/baseof.html | 5 +++ layouts/_default/list.html | 44 ------------------ layouts/blog/list.html | 39 ++++++++++++++++ 4 files changed, 130 insertions(+), 44 deletions(-) create mode 100644 content/blog/blog.css delete mode 100644 layouts/_default/list.html create mode 100644 layouts/blog/list.html diff --git a/content/blog/blog.css b/content/blog/blog.css new file mode 100644 index 0000000..8d99e9e --- /dev/null +++ b/content/blog/blog.css @@ -0,0 +1,86 @@ +@import url(/styles/reset.css); +@import url(/styles/root.css); + +:root { + --post-item-highlight-color: #efefef; +} +@media (prefers-color-scheme: dark) { + :root { + --post-item-highlight-color: #121212; + } +} + +.post-list { + list-style: none; + margin: 0; + padding: 0; +} +@supports (display: subgrid) { + .post-list { + align-items: baseline; + display: grid; + gap: 1em; + grid-template-columns: + minmax(150px, max-content) minmax(20px, max-content) 3px auto; + grid-template-areas: "month day line title"; + } +} + +.post-list li { + align-items: baseline; + border-radius: 6px; + display: grid; + gap: 1em; + transition: background-color 0.25s; +} +@supports not (display: subgrid) { + .post-list li { + grid-template-columns: 100px 20px 3px auto; + grid-template-areas: "month day thing title"; + } +} +@supports (display: subgrid) { + .post-list li { + display: subgrid; + } +} + +.post-list li time:nth-of-type(1) { + grid-area: month; + text-align: end; +} + +.post-list li time:nth-of-type(2) { + grid-area: day; + text-align: end; +} + +.post-list b { + background-color: #ddd; + display: block; + grid-area: thing; + height: 100%; + text-align: end; + width: 100%; +} + +.post-list li h1 { + font-family: var(--font-family-body); + grid-area: title; + text-align: start; +} + +.post-list li:hover { + background-color: var(--post-item-highlight-color); +} + +.post-list h1 { + font-size: inherit; + font-weight: normal; + margin: 0; + padding: 0; +} + +.post-list a { + color: inherit; +} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4837f09..c7601a0 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -28,6 +28,11 @@ {{ if not hugo.IsProduction }} {{ end }} + {{ if gt (len .Section) 0 }} + {{ range .FirstSection.Resources.Match "*.css" }} + + {{ end }} + {{ end }} {{ range .Resources.Match "*.css" }} {{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html deleted file mode 100644 index af7074d..0000000 --- a/layouts/_default/list.html +++ /dev/null @@ -1,44 +0,0 @@ - -{{ define "main" }} -{{ if .Title }} -
-

{{ .Title }}

-
-{{ end }} - -{{ $pages := union .RegularPages .Sections }} -{{ if .IsHome }} - {{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} -{{ end }} - -{{ .Content }} - - - -{{ if gt $paginator.TotalPages 1 }} - -{{ end }} -{{ end }} diff --git a/layouts/blog/list.html b/layouts/blog/list.html new file mode 100644 index 0000000..dca3b6d --- /dev/null +++ b/layouts/blog/list.html @@ -0,0 +1,39 @@ +{{ define "header" }} + {{ partial "header.html" . }} +{{ end }} + +{{ define "main" }} +{{ $pages := union .RegularPages .Sections }} +{{ if .IsHome }} + {{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }} +{{ end }} + +{{ .Content }} + +{{ range .Pages.ByDate.GroupByDate "2006" }} +

{{ .Key }}

+ +{{ end }} +{{ end }} + +{{ define "footer" }} + {{ partial "footer.html" . }} +{{ end }} + +{{ define "styles" }} + +{{ end }}