From db0f6027c19dfd7d446efe7c8bf2ad675a77de61 Mon Sep 17 00:00:00 2001 From: Alexander Avery Date: Mon, 2 Sep 2024 20:32:32 -0400 Subject: [PATCH] simplify layouts; allow optional pre-content partial --- assets/sass/cards.scss | 65 +++++--------------- assets/sass/code.scss | 2 +- assets/sass/colors.scss | 13 ++-- assets/sass/main.scss | 10 ++- layouts/_default/list.html | 2 +- layouts/_default/single.html | 4 ++ layouts/authors/list.html | 2 +- layouts/authors/terms.html | 2 +- layouts/games/list.html | 2 +- layouts/partials/article-alternate.html | 14 +++++ layouts/partials/article-card-alternate.html | 14 ----- layouts/partials/article-card.html | 27 -------- layouts/partials/article.html | 22 +++++++ layouts/partials/header.html | 8 +-- 14 files changed, 78 insertions(+), 109 deletions(-) create mode 100644 layouts/partials/article-alternate.html delete mode 100644 layouts/partials/article-card-alternate.html delete mode 100644 layouts/partials/article-card.html create mode 100644 layouts/partials/article.html diff --git a/assets/sass/cards.scss b/assets/sass/cards.scss index 05186d2..5795f91 100644 --- a/assets/sass/cards.scss +++ b/assets/sass/cards.scss @@ -13,65 +13,30 @@ } } +.small-circle { + border-radius: 50%; + width: 250px; + height: 250px; +} + article { - display: flex; background-color: $dark; border-radius: 10px; -} - -article.card { height: 420px; flex: 1 1 305px; - flex-direction: column; overflow: hidden; - div.article-info-container, div.article-image { - overflow: hidden; - flex: 1; - } - - div.article-info { - box-sizing: border-box; - padding: 25px; - height: 200px; - display: flex; - flex-direction: column; - - a.article-title { - flex: 2; - display: flex; - justify-content: space-between; - flex-direction: column; - text-decoration: none; - color: $font-color; - } + img { + height: 50%; + width: 100%; + object-fit: cover; } -} - -.circle { - border-radius: 50%; -} - -.article-link { - text-decoration: none; - color: $font-color; -} - -article.card-alternate { - justify-content: space-evenly; - align-items: center; - flex-wrap: wrap; - gap: 40px; div { - padding: 16px; - } - img { - width: 250px; - height: 250px; - border-radius: 50%; - } - p { - max-width: 500px; + margin: 25px; + display: flex; + flex-direction: column; + justify-content: space-between; } + } diff --git a/assets/sass/code.scss b/assets/sass/code.scss index 32a0a8d..660b1e6 100644 --- a/assets/sass/code.scss +++ b/assets/sass/code.scss @@ -26,6 +26,6 @@ pre { white-space: pre; max-width: 100%; overflow-x: auto; - border-left: .3rem solid $beetbox-purple; + border-left: .3rem solid $code-edge; } } diff --git a/assets/sass/colors.scss b/assets/sass/colors.scss index 906f6ba..9384057 100644 --- a/assets/sass/colors.scss +++ b/assets/sass/colors.scss @@ -1,13 +1,14 @@ -$background-color: #1f2835; -$font-color: #f8f8ff; -$top-bar: #f8f8ffcc; - $beetbox-red: #9e0008; $beetbox-pink: #d93370; $beetbox-purple: #ac65cb; $beetbox-green: #003f56; $beetbox-blue: #5fcfd0; +$background-color: #1f2835; +$font-color: #f8f8ff; +$font-color-alternate: #1f2835; +$top-bar: #f8f8ffcc; $dark: #111; -$visited-link: #e4cdef; - +$link-color: $beetbox-blue; +$link-color-visited: #e4cdef; +$code-edge: $beetbox-purple; diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 286b592..ca4264b 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -35,7 +35,7 @@ header { margin: auto; font-weight: bold; text-decoration: none; - color: $background-color; + color: $font-color-alternate; } } } @@ -56,10 +56,10 @@ header { } a { - color: $beetbox-blue; + color: $link-color; &:visited, &:hover { - color: $visited-link; + color: $link-color-visited; } } @@ -113,6 +113,10 @@ img.featured { align-items: end; } +.align-center { + align-items: center; +} + section { max-width: 1000px; margin: 16px auto; diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 6854b99..a16e88d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -14,7 +14,7 @@
{{ range $pages }} - {{ partial "article-card.html" . }} + {{ partial "article.html" . }} {{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3e10ba2..082a91e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,6 +8,10 @@ {{ .TableOfContents }} {{ end }} + {{ if templates.Exists "partials/pre-content.html" }} + {{ partial "pre-content.html" . }} + {{ end }} + {{ .Content }}

diff --git a/layouts/authors/list.html b/layouts/authors/list.html index f0738d9..cd5a915 100644 --- a/layouts/authors/list.html +++ b/layouts/authors/list.html @@ -26,7 +26,7 @@

{{ range .Data.Pages }} - {{ partial "article-card.html" . }} + {{ partial "article.html" . }} {{ end }}
diff --git a/layouts/authors/terms.html b/layouts/authors/terms.html index fcfe3d3..605f26c 100644 --- a/layouts/authors/terms.html +++ b/layouts/authors/terms.html @@ -3,7 +3,7 @@
{{ range .Data.Pages }} - {{ partial "article-card-alternate.html" . }} + {{ partial "article-alternate.html" . }} {{ end }}
{{ end }} diff --git a/layouts/games/list.html b/layouts/games/list.html index 4e408e0..5da3fbe 100644 --- a/layouts/games/list.html +++ b/layouts/games/list.html @@ -18,7 +18,7 @@
{{ range .Data.Pages }} - {{ partial "article-card.html" . }} + {{ partial "article.html" . }} {{ end }}
diff --git a/layouts/partials/article-alternate.html b/layouts/partials/article-alternate.html new file mode 100644 index 0000000..4904ec9 --- /dev/null +++ b/layouts/partials/article-alternate.html @@ -0,0 +1,14 @@ + +
+
+ {{ with .Resources.GetMatch "avatar" }} + {{ .Params.alt }} + {{ end }} +
+
+

{{ .Params.name }}

+

{{ .Params.bio }}

+
+
+
+ diff --git a/layouts/partials/article-card-alternate.html b/layouts/partials/article-card-alternate.html deleted file mode 100644 index ab1df6c..0000000 --- a/layouts/partials/article-card-alternate.html +++ /dev/null @@ -1,14 +0,0 @@ - -
-
- {{ with .Resources.GetMatch "avatar" }} - {{ .Params.alt }} - {{ end }} -
-
-

{{ .Params.name }}

-

{{ .Params.bio }}

-
-
-
- diff --git a/layouts/partials/article-card.html b/layouts/partials/article-card.html deleted file mode 100644 index c0b7abf..0000000 --- a/layouts/partials/article-card.html +++ /dev/null @@ -1,27 +0,0 @@ -
-
- - {{ $image := .Resources.GetMatch "featured" }} - {{ partial "image.html" (dict "image" $image "alt" .Params.featured.alt "class" "fill-wh")}} - -
- -
diff --git a/layouts/partials/article.html b/layouts/partials/article.html new file mode 100644 index 0000000..ab6853a --- /dev/null +++ b/layouts/partials/article.html @@ -0,0 +1,22 @@ +
+ + + {{ $image := .Resources.GetMatch "featured" }} + {{ partial "image.html" (dict "image" $image "alt" .Params.featured.alt) }} + + +
+ + {{ with index (.GetTerms "tags") 0 }} + {{ .LinkTitle }} + {{ end }} + +

{{ .Title | markdownify }}

+ + {{ with .Date }} +

{{ .Format "2006/01/02" }}

+ {{ end }} + +
+ +
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 966de5d..52ae509 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,10 +1,10 @@