From a0c0ac2349086fa43480465353752445c9ec2770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 17 Apr 2017 17:13:17 +0200 Subject: [PATCH 1/5] Add themesDir to exampleSite config So it is runnable out-of-the-box. --- exampleSite/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 69ce1cf..ce9dd69 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -2,6 +2,7 @@ title = "Notre-Dame de Paris" baseURL = "https://example.com" languageCode = "en-us" theme = "gohugo-theme-ananke" +themesDir = "../.." MetaDataFormat = "yaml" DefaultContentLanguage = "en" From a947472c6bd05db7a3bb625ea66b54aa9ca4d442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 17 Apr 2017 17:27:26 +0200 Subject: [PATCH 2/5] Use Site.Params.mainSections to select pages on home page This helps with theme portability. Also use Site.RegularPages in its default sort, as this is probably what most people want. --- layouts/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layouts/index.html b/layouts/index.html index 3da9bfe..69e5529 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -2,8 +2,10 @@
{{ .Content }}
- {{/* Create a variable to use the same section twice. Note that we've included the date here. */}} - {{ $section := where .Data.Pages.ByDate.Reverse "Section" "post" }} + {{/* For Hugo 0.20 this will default to the section with the most number of pages. */}} + {{ $mainSections := .Site.Params.mainSections | default (slice "post") }} + {{/* Create a variable to use the same section twice. */}} + {{ $section := where .Site.RegularPages "Section" "in" $mainSections }} {{ if $section }}
From 2fac73dfacfc04f9e942e7b37e9cffd6dc09c6b5 Mon Sep 17 00:00:00 2001 From: Bud Parr Date: Mon, 17 Apr 2017 18:30:22 -0400 Subject: [PATCH 3/5] switch home page work with a variety of sections after earlier PR --- layouts/index.html | 2 +- layouts/partials/summary-with-image.html | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/summary-with-image.html diff --git a/layouts/index.html b/layouts/index.html index 69e5529..35ba8fe 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -16,7 +16,7 @@
{{ range (first 3 $section) }}
- {{ .Render "summary-with-image" }} + {{ partial "summary-with-image.html" }}
{{ end }}
diff --git a/layouts/partials/summary-with-image.html b/layouts/partials/summary-with-image.html new file mode 100644 index 0000000..2831ae1 --- /dev/null +++ b/layouts/partials/summary-with-image.html @@ -0,0 +1,19 @@ + From 3b211400c447a52badd1db512e89f0ec35e69a66 Mon Sep 17 00:00:00 2001 From: Bud Parr Date: Mon, 17 Apr 2017 18:33:54 -0400 Subject: [PATCH 4/5] fix issue count --- layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/index.html b/layouts/index.html index 35ba8fe..9e0f976 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -24,7 +24,7 @@

More Posts

{{/* Nest the requirements, "after" then "first" on the outside */}} - {{ range (first 4 (after 1 $section)) }} + {{ range (first 4 (after 3 $section)) }}

{{ .Title }} From 3e722a96d71738db4b642eb48a3f78c6f29fc27a Mon Sep 17 00:00:00 2001 From: Bud Parr Date: Mon, 17 Apr 2017 18:34:05 -0400 Subject: [PATCH 5/5] mind the dot! --- layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/index.html b/layouts/index.html index 9e0f976..90bdd02 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -16,7 +16,7 @@
{{ range (first 3 $section) }}
- {{ partial "summary-with-image.html" }} + {{ partial "summary-with-image.html" . }}
{{ end }}