From 56e4e95d9e325e6a3fe550a4d1165f32d390a62b Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Thu, 3 May 2018 18:53:52 -0600 Subject: [PATCH] Use lang.Merge to "fill in the gaps" for untranslated pages For example, to get pages under the About Hugo section to show up on https://gohugo.io/zh/about/. This commit is non-exhaustive; more work is necessary. Also bump theme min_version to 0.38 due to the use of the new lang.Merge function. --- .../gohugoioTheme/layouts/_default/list.html | 3 ++- themes/gohugoioTheme/layouts/news/list.html | 3 ++- .../layouts/page/documentation-home.html | 2 +- .../layouts/partials/nav-links-docs.html | 26 +++++++++---------- themes/gohugoioTheme/theme.toml | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/themes/gohugoioTheme/layouts/_default/list.html b/themes/gohugoioTheme/layouts/_default/list.html index a0835342a..3b7a2307e 100755 --- a/themes/gohugoioTheme/layouts/_default/list.html +++ b/themes/gohugoioTheme/layouts/_default/list.html @@ -1,4 +1,5 @@ {{ define "main" }} - {{ $section_to_display := .Sections | default .Paginator.Pages }} + {{ $paginator := .Paginate (.Pages | lang.Merge (where .Sites.First.RegularPages "Section" .Section)) }} + {{ $section_to_display := .Sections | default $paginator.Pages }} {{ partial "pagelayout.html" (dict "context" . "section_to_display" $section_to_display ) }} {{ end }} diff --git a/themes/gohugoioTheme/layouts/news/list.html b/themes/gohugoioTheme/layouts/news/list.html index 716966e17..5a5284658 100644 --- a/themes/gohugoioTheme/layouts/news/list.html +++ b/themes/gohugoioTheme/layouts/news/list.html @@ -28,7 +28,8 @@ {{ $interior_classes := $.Site.Params.flex_box_interior_classes }}
- {{ range .Paginator.Pages }} + {{ $paginator := .Paginate (.Pages | lang.Merge (where .Sites.First.RegularPages "Section" .Section)) -}} + {{ range $paginator.Pages }} {{ partial "boxes-section-summaries" (dict "context" . "classes" $interior_classes "fullcontent" false) }} {{ end }}
diff --git a/themes/gohugoioTheme/layouts/page/documentation-home.html b/themes/gohugoioTheme/layouts/page/documentation-home.html index 04b57d4ca..91f744c30 100644 --- a/themes/gohugoioTheme/layouts/page/documentation-home.html +++ b/themes/gohugoioTheme/layouts/page/documentation-home.html @@ -1,4 +1,4 @@ {{ define "main" }} -{{ $section_to_display := (.Site.Taxonomies.categories.fundamentals).Pages }} +{{ $section_to_display := (.Site.Taxonomies.categories.fundamentals).Pages | lang.Merge (.Sites.First.Taxonomies.categories.fundamentals).Pages }} {{ partial "pagelayout.html" (dict "context" . "section_to_display" $section_to_display ) }} {{ end }} diff --git a/themes/gohugoioTheme/layouts/partials/nav-links-docs.html b/themes/gohugoioTheme/layouts/partials/nav-links-docs.html index 444715471..61aa11dde 100644 --- a/themes/gohugoioTheme/layouts/partials/nav-links-docs.html +++ b/themes/gohugoioTheme/layouts/partials/nav-links-docs.html @@ -6,18 +6,18 @@
  • {{ .Name }} - {{ if .HasChildren }} - - {{end}} -
  • - {{end}} + {{- if .HasChildren }} + + {{- end}} + + {{- end}} diff --git a/themes/gohugoioTheme/theme.toml b/themes/gohugoioTheme/theme.toml index 7334c0e2e..fe55ec76e 100644 --- a/themes/gohugoioTheme/theme.toml +++ b/themes/gohugoioTheme/theme.toml @@ -8,7 +8,7 @@ description = "" homepage = "https://github.com/budparr/gohugo.io" tags = ["website"] features = ["", ""] -min_version = 0.18 +min_version = 0.38 [author] name = "Bud Parr"