From 390ad616942c7a62c4bef07b57233832b1e824c0 Mon Sep 17 00:00:00 2001 From: Ian Cook <6866411+nai888@users.noreply.github.com> Date: Mon, 20 Mar 2023 19:45:44 -0500 Subject: [PATCH 1/4] Enable inverting homepage section styling Add invert Param to the config file. Add the 'odd' class to the post-holders and the 'even' class to the post-afters using Hugo if statements instead of using JS. Marking invert = true in the config file flips which sections are marked odd and even. --- assets/js/index.js | 8 -------- exampleSite/config.toml | 3 +++ layouts/index.html | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/assets/js/index.js b/assets/js/index.js index 838adbc..5a1a4e1 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -28,17 +28,9 @@ var $sitehead = $("#site-head"); } } $(document).ready(function () { - $postholder.each(function (e) { - if (e % 2 != 0) $(this).addClass("odd"); - }); - $postafter.each(function (e) { var bg = $(this).parent().css("background-color"); $(this).css("border-top-color", bg); - - if (e % 2 == 0) { - $(this).addClass("even"); - } }); $("a.btn.site-menu").click(function (e) { diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e105224..c7ac694 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -44,6 +44,9 @@ title = "Jane Doe - Nutrition Coach & Chef Consultant" # This theme will, by default, inject a design-by-line at the bottom of the page. # You can turn it off, but we would really appreciate if you don’t :-) hidedesignbyline = false + + # The sections of the home page alternate styling. Mark invert as true to swap the styling of the sections + invert = false [params.meta] keywords = "some, keywords, for, seo, you, know, google, duckduckgo, and, such" diff --git a/layouts/index.html b/layouts/index.html index 764616f..673a156 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -28,7 +28,7 @@
{{ range $index_val, $elem_val := $filtered }} -
+

{{ .Title | safeHTML }}

@@ -37,7 +37,7 @@ {{ .Content }}
-
+
{{ end }} From 104cb845702a62427f65e230a659cb612a7320ef Mon Sep 17 00:00:00 2001 From: Ian Cook <6866411+nai888@users.noreply.github.com> Date: Tue, 21 Mar 2023 10:12:20 -0500 Subject: [PATCH 2/4] Change "invert" Param to "invertSectionColors" --- exampleSite/config.toml | 2 +- layouts/index.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index c7ac694..089c65d 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -46,7 +46,7 @@ title = "Jane Doe - Nutrition Coach & Chef Consultant" hidedesignbyline = false # The sections of the home page alternate styling. Mark invert as true to swap the styling of the sections - invert = false + invertSectionColors = false [params.meta] keywords = "some, keywords, for, seo, you, know, google, duckduckgo, and, such" diff --git a/layouts/index.html b/layouts/index.html index 673a156..a781026 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -28,7 +28,7 @@
{{ range $index_val, $elem_val := $filtered }} -
+

{{ .Title | safeHTML }}

@@ -37,7 +37,7 @@ {{ .Content }}
-
+
{{ end }} From 147b87c3de6886f5bc0659943f6f2e8bfbc4f46c Mon Sep 17 00:00:00 2001 From: Ian Cook <6866411+nai888@users.noreply.github.com> Date: Tue, 21 Mar 2023 10:13:01 -0500 Subject: [PATCH 3/4] Swap "odd" and "even" for "dark" and "light" classes --- assets/css/screen.css | 12 ++++++------ layouts/index.html | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/css/screen.css b/assets/css/screen.css index 15f3019..4425658 100644 --- a/assets/css/screen.css +++ b/assets/css/screen.css @@ -356,13 +356,13 @@ table table table { background-color: #fff; } -table tbody > tr:nth-child(odd) > td, -table tbody > tr:nth-child(odd) > th { +table tbody > tr:nth-child(dark) > td, +table tbody > tr:nth-child(dark) > th { background-color: #f6f6f6; } -table.plain tbody > tr:nth-child(odd) > td, -table.plain tbody > tr:nth-child(odd) > th { +table.plain tbody > tr:nth-child(dark) > td, +table.plain tbody > tr:nth-child(dark) > th { background: transparent; } @@ -466,7 +466,7 @@ li { background: #f2efe8; position: relative; } -.post-holder.odd { +.post-holder.dark { background: #b80135; color: white; } @@ -528,7 +528,7 @@ a.fn-item.active { border-top: 50px solid #f2efe8; border-radius: 25px; } -.post-after.even { +.post-after.light { left: 6%; } diff --git a/layouts/index.html b/layouts/index.html index a781026..2c1d62d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -28,7 +28,7 @@
{{ range $index_val, $elem_val := $filtered }} -
+

{{ .Title | safeHTML }}

@@ -37,7 +37,7 @@ {{ .Content }}
-
+
{{ end }} From 2d9ea74d0807168af6753165491f021439803022 Mon Sep 17 00:00:00 2001 From: Ian Cook <6866411+nai888@users.noreply.github.com> Date: Tue, 21 Mar 2023 10:15:49 -0500 Subject: [PATCH 4/4] Fix erroneous CSS changes --- assets/css/screen.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/css/screen.css b/assets/css/screen.css index 4425658..f3a3b4b 100644 --- a/assets/css/screen.css +++ b/assets/css/screen.css @@ -356,13 +356,13 @@ table table table { background-color: #fff; } -table tbody > tr:nth-child(dark) > td, -table tbody > tr:nth-child(dark) > th { +table tbody > tr:nth-child(odd) > td, +table tbody > tr:nth-child(odd) > th { background-color: #f6f6f6; } -table.plain tbody > tr:nth-child(dark) > td, -table.plain tbody > tr:nth-child(dark) > th { +table.plain tbody > tr:nth-child(odd) > td, +table.plain tbody > tr:nth-child(odd) > th { background: transparent; }