From 804c44f37d5aee2e9eedd21a36ff50910310526b Mon Sep 17 00:00:00 2001 From: Jesper Kolbeck Date: Thu, 2 Dec 2021 19:47:34 +0100 Subject: [PATCH 1/9] Add both first and last classes when only one page --- layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/index.html b/layouts/index.html index 9f3daa3..8096ce5 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -21,7 +21,7 @@ {{ range $index_val, $elem_val := $sections }}
-
+

{{ .Title }}

From b8e0f89eb0cda9513f946ae8072e0526b8d6c8f6 Mon Sep 17 00:00:00 2001 From: Jesper Kolbeck Date: Wed, 8 Dec 2021 21:54:55 +0100 Subject: [PATCH 2/9] Make it possible to have a short menu and button name --- exampleSite/content/homepage/services.md | 3 ++- layouts/index.html | 12 ++++++++++-- static/js/index.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/exampleSite/content/homepage/services.md b/exampleSite/content/homepage/services.md index fde7687..c21d2a0 100644 --- a/exampleSite/content/homepage/services.md +++ b/exampleSite/content/homepage/services.md @@ -1,5 +1,6 @@ --- -title: "Services" +title: "The Services I Offer" +name: "My Services" weight: 2 header_menu: true --- diff --git a/layouts/index.html b/layouts/index.html index d66bf9e..632c338 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -10,7 +10,11 @@ {{ with .Params.header_subheadline }}

{{ . }}

{{ end }} {{ range where $sections ".Params.header_menu" "eq" true }} - {{ .Title }} + {{ $button_title := .Title }} + {{ with .Params.Name }} + {{ $button_title = . }} + {{ end }} + {{ $button_title }} {{ end }}
@@ -21,10 +25,14 @@
{{ range $index_val, $elem_val := $sections }} + {{ $fnav_title := .Title }} + {{ with .Params.Name }} + {{ $fnav_title = . }} + {{ end }}
-

{{ .Title }}

+

{{ .Title }}

{{ .Content }} diff --git a/static/js/index.js b/static/js/index.js index 24c34c5..58a41ca 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -49,7 +49,7 @@ var $sitehead = $("#site-head"); }); $(".post-title").each(function () { - var t = $(this).text(); + var t = $(this).data("fnav-title"); var index = $(this).parents(".post-holder").index(); $fnav.append( "" + t + "" From 264742eb3efd7352aa968e03579fca0f74196ecb Mon Sep 17 00:00:00 2001 From: Jesper Kolbeck Date: Wed, 8 Dec 2021 22:05:13 +0100 Subject: [PATCH 3/9] Update homepage archetype with name --- archetypes/homepage.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/archetypes/homepage.md b/archetypes/homepage.md index 9a01e46..447e4cd 100644 --- a/archetypes/homepage.md +++ b/archetypes/homepage.md @@ -1,9 +1,15 @@ --- title: '{{ replace .Name "-" " " | title }}' + +# The "name" value will be used as text for buttons and fixed menu items. +# The "title" will be used if "name" is not provided. +#name: 'Short Title' + # The "weight" will determine where this section appears on the "homepage". # A bigger weight will place the content more towards the bottom of the page. # It's like gravity ;-). weight: 5 + # If "header_menu" is true, then a button linking to this section will be placed # into the header menu at the top of the homepage. header_menu: true From 4ea916f8b870c6717eb98db8eb540c91da2c3cb0 Mon Sep 17 00:00:00 2001 From: Jesper Kolbeck Date: Wed, 8 Dec 2021 22:12:31 +0100 Subject: [PATCH 4/9] Fix wording in archetype --- archetypes/homepage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archetypes/homepage.md b/archetypes/homepage.md index 447e4cd..b2e444a 100644 --- a/archetypes/homepage.md +++ b/archetypes/homepage.md @@ -2,7 +2,7 @@ title: '{{ replace .Name "-" " " | title }}' # The "name" value will be used as text for buttons and fixed menu items. -# The "title" will be used if "name" is not provided. +# The "title" value will be used if value for "name" is not provided. #name: 'Short Title' # The "weight" will determine where this section appears on the "homepage". From 74bdc30f2b3dc1f2010561bd20221800163a5ee7 Mon Sep 17 00:00:00 2001 From: Jesper Kolbeck Date: Fri, 10 Dec 2021 15:28:52 +0100 Subject: [PATCH 5/9] Fix button and add hash to URL --- layouts/index.html | 2 +- static/js/index.js | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index 632c338..4e6750f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -14,7 +14,7 @@ {{ with .Params.Name }} {{ $button_title = . }} {{ end }} - {{ $button_title }} + {{ $button_title }} {{ end }}
diff --git a/static/js/index.js b/static/js/index.js index 58a41ca..652197f 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -13,12 +13,15 @@ var $sitehead = $("#site-head"); /* Globals jQuery, document */ (function ($) { "use strict"; - function srcTo(el) { + function srcTo(el, dur = 1000) { $("html, body").animate( { scrollTop: el.offset().top, }, - 1000 + dur, + function() { + window.location.hash = el.attr("id"); + } ); } function srcToAnchorWithTitle(str) { @@ -51,19 +54,14 @@ var $sitehead = $("#site-head"); $(".post-title").each(function () { var t = $(this).data("fnav-title"); var index = $(this).parents(".post-holder").index(); + var postId = $(this).closest("article.post").attr('id'); $fnav.append( - "" + t + "" + "" + t + "" ); $(".fn-item").click(function () { - var i = $(this).attr("item_index"); - var s = $(".post[item_index='" + i + "']"); - - $("html, body").animate( - { - scrollTop: s.offset().top, - }, - 400 - ); + var postId = $(this).data("post-id"); + var s = $("#" + postId); + srcTo(s, 400); }); }); From a28a76767a00a08cfdeee2f3cf6cef55498901ff Mon Sep 17 00:00:00 2001 From: Jesper Kolbeck Date: Sun, 6 Feb 2022 18:15:49 +0100 Subject: [PATCH 6/9] Rename title overwrite properties to header_menu_title and navigation_menu_title --- archetypes/homepage.md | 10 +++++++--- exampleSite/content/homepage/services.md | 3 ++- layouts/index.html | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/archetypes/homepage.md b/archetypes/homepage.md index b2e444a..2973c4a 100644 --- a/archetypes/homepage.md +++ b/archetypes/homepage.md @@ -1,9 +1,13 @@ --- title: '{{ replace .Name "-" " " | title }}' -# The "name" value will be used as text for buttons and fixed menu items. -# The "title" value will be used if value for "name" is not provided. -#name: 'Short Title' +# The "header_menu_title" value will be used as text for header buttons. +# The "title" value will be used if value for "header_menu_title" is not provided. +#header_menu_title: 'Short Menu Title' + +# The "navigation_menu_title" value will be used as text for fixed menu items. +# The "title" value will be used if value for "navigation_menu_title" is not provided. +#navigation_menu_title: 'Short Menu Title' # The "weight" will determine where this section appears on the "homepage". # A bigger weight will place the content more towards the bottom of the page. diff --git a/exampleSite/content/homepage/services.md b/exampleSite/content/homepage/services.md index c21d2a0..f54e691 100644 --- a/exampleSite/content/homepage/services.md +++ b/exampleSite/content/homepage/services.md @@ -1,6 +1,7 @@ --- title: "The Services I Offer" -name: "My Services" +header_menu_title: "My Services" +navigation_menu_title: "Services" weight: 2 header_menu: true --- diff --git a/layouts/index.html b/layouts/index.html index 4e6750f..39b8dcb 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -11,7 +11,7 @@ {{ range where $sections ".Params.header_menu" "eq" true }} {{ $button_title := .Title }} - {{ with .Params.Name }} + {{ with .Params.header_menu_title }} {{ $button_title = . }} {{ end }} {{ $button_title }} @@ -26,7 +26,7 @@ {{ range $index_val, $elem_val := $sections }} {{ $fnav_title := .Title }} - {{ with .Params.Name }} + {{ with .Params.navigation_menu_title }} {{ $fnav_title = . }} {{ end }}
From d6aa708294f659c5a224555ee95efb523c3f5651 Mon Sep 17 00:00:00 2001 From: zjedi Date: Wed, 22 Mar 2023 00:51:54 +0100 Subject: [PATCH 7/9] exampleSite feature documentation --- exampleSite/content/homepage/services.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/exampleSite/content/homepage/services.md b/exampleSite/content/homepage/services.md index 69b863b..87968ee 100644 --- a/exampleSite/content/homepage/services.md +++ b/exampleSite/content/homepage/services.md @@ -1,11 +1,16 @@ --- title: "The Services I Offer" -header_menu_title: "My Services" -navigation_menu_title: "Services" +header_menu_title: "Services" +navigation_menu_title: "My Services" weight: 2 header_menu: true --- +Feature notice: This section displays options to customize title: +- has a normal section title (`title` = "The Services I Offer"), +- custom welcome screen title (`header_menu_title` = "Services"), +- custom navigation menu title (`navigation_menu_title` = "My Services"). + That is the important part, right? You want to know what I can do for you. This is why I put this right up there into the header menu of the website. --- @@ -20,18 +25,10 @@ Wow. That was nice, right? Well, call me and let us talk. ### Chef Consulting -Did you see the picture above? I can show you how to go from - -![Let us get started on a clean slate](images/board-bunch-cooking-food-349609.jpg) - -to +I can raise your table culture! ![Let us get started on a clean slate](images/woman-pouring-juice-on-glass-3184192.jpg) -in estimated seconds. - ---- - Want to learn more about my services? -Check out [dedicated page](services) with a lot more details. +Check out [dedicated page](services) with more details. From 3a3651a99960a11e5efbaee59eb78fb444edf543 Mon Sep 17 00:00:00 2001 From: zjedi Date: Wed, 22 Mar 2023 00:55:49 +0100 Subject: [PATCH 8/9] shorter 0.2s scroll-to animation, helps to reduce frustration from being prevented from scrolling --- assets/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/index.js b/assets/js/index.js index b78d9aa..cf9813c 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -53,7 +53,7 @@ var $sitehead = $("#site-head"); $(".fn-item").click(function () { var postId = $(this).data("post-id"); var s = $("#" + postId); - srcTo(s, 400); + srcTo(s, 200); }); }); From 7954c690a4eaf52b597bb766744d00fd6ade65d4 Mon Sep 17 00:00:00 2001 From: zjedi Date: Thu, 23 Mar 2023 18:01:14 +0100 Subject: [PATCH 9/9] - fix: remove visual arrow from foooter. - Single-page navigation URL uses navigation_menu_title if available --- layouts/index.html | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index 8efcb1a..38ba28c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,38 +2,45 @@ {{ $headless := .Site.GetPage "/homepage" }} {{ $sections := $headless.Resources.ByType "page" }} {{ $sections := cond .Site.BuildDrafts $sections (where $sections "Draft" "==" false) }} -{{ $filtered := where $sections "Params.external" "==" nil }} + +
-
-
- {{ range $index_val, $elem_val := $filtered }} - {{ $fnav_title := .Title }} - {{ with .Params.navigation_menu_title }}{{ $fnav_title = . }}{{ end }} + +
+ + + {{ $content := where $sections "Params.external" "==" nil }} + {{ range $index_val, $elem_val := $content }} + {{ $fnav_title := .Title }}{{ with .Params.navigation_menu_title }}{{ $fnav_title = . }}{{ end }}
-
+

{{ .Title | safeHTML }}