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] 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 @@