diff --git a/archetypes/homepage.md b/archetypes/homepage.md index 9a01e46..2973c4a 100644 --- a/archetypes/homepage.md +++ b/archetypes/homepage.md @@ -1,9 +1,19 @@ --- title: '{{ replace .Name "-" " " | 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. # 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 diff --git a/assets/js/index.js b/assets/js/index.js index 5a1a4e1..cf9813c 100644 --- a/assets/js/index.js +++ b/assets/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) { @@ -41,21 +44,16 @@ 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(); + 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, 200); }); }); diff --git a/exampleSite/content/homepage/services.md b/exampleSite/content/homepage/services.md index 01ac68e..87968ee 100644 --- a/exampleSite/content/homepage/services.md +++ b/exampleSite/content/homepage/services.md @@ -1,9 +1,16 @@ --- -title: "Services" +title: "The Services I Offer" +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. --- @@ -18,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. diff --git a/layouts/index.html b/layouts/index.html index 2c1d62d..38ba28c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,36 +2,47 @@ {{ $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 }} + +
+ + + {{ $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 }}

+

{{ .Title | safeHTML }}

{{ .Content }}