diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index cad8d68d03..445be9c278 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -1,17 +1,15 @@
-{{- $pctx := . -}}
-{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
-{{- $pages := slice -}}
-{{- if or $.IsHome $.IsSection -}}
-{{- $pages = $pctx.RegularPages -}}
-{{- else -}}
-{{- $pages = $pctx.Pages -}}
-{{- end -}}
-{{- $limit := .Site.Config.Services.RSS.Limit -}}
-{{- if ge $limit 1 -}}
-{{- $pages = $pages | first $limit -}}
-{{- end -}}
{{- printf "" | safeHTML }}
{{- partial "page-meta.go" . }}
+{{- $pages := .Page.Pages }}
+{{- if .Page.IsHome }}
+ {{- $pages = .Page.Sections }}
+{{- else if .Page.Sections}}
+ {{- $pages = (.Page.Pages | union .Page.Sections) }}
+{{- end }}
+{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- if ge $limit 0 -}}
+ {{- $pages = $pages | first $limit -}}
+{{- end }}
{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}
@@ -26,17 +24,19 @@
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "" .Permalink .MediaType | safeHTML }}
{{- end -}}
- {{ range $pages }}
- {{- if and .Permalink .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) }}
+ {{- range $pages }}
+ {{- if and .Permalink .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) }}
-
{{ .Title }}
{{ .Permalink }}
{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}
- {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}
+ {{- with .Site.Author.email }}
+ {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}
+ {{- end }}
{{ .Permalink }}
{{ .Summary | html }}
{{- end }}
- {{ end }}
+ {{- end }}
\ No newline at end of file
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
index 63fe665792..aae5934b8e 100644
--- a/layouts/partials/menu.html
+++ b/layouts/partials/menu.html
@@ -109,11 +109,12 @@
{{- partial "menu-pre.html" . }}{{ or .Params.menuTitle .LinkTitle .Title }}{{ partial "menu-post.html" . }}
{{- if $showvisitedlinks }}{{ end }}
- {{- $currentNode.Scratch.Set "pages" .Pages }}
- {{- if .Sections}}
- {{- $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
+ {{- $pages := .Pages }}
+ {{- if .Page.IsHome }}
+ {{- $pages = .Sections }}
+ {{- else if .Page.Sections}}
+ {{- $pages = (.Pages | union .Sections) }}
{{- end }}
- {{- $pages := ($currentNode.Scratch.Get "pages") }}
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}
{{- if eq .Site.Params.ordersectionsby "title" }}
{{- range $pages.ByTitle }}
diff --git a/layouts/partials/page-meta.go b/layouts/partials/page-meta.go
index a5c67fd50a..f7833c0477 100644
--- a/layouts/partials/page-meta.go
+++ b/layouts/partials/page-meta.go
@@ -2,6 +2,7 @@
{{- $currentNode.Scratch.Set "relearnIsSelfFound" nil }}
{{- $currentNode.Scratch.Set "relearnPrevPage" nil }}
{{- $currentNode.Scratch.Set "relearnNextPage" nil }}
+{{- $currentNode.Scratch.Set "relearnSubPages" nil }}
{{- template "relearn-structure" dict "node" .Site.Home "currentnode" $currentNode "hiddenstem" false "hiddencurrent" false }}
{{- define "relearn-structure" }}
{{- $currentNode := .currentnode }}
@@ -34,11 +35,11 @@
{{- end }}
{{- $currentNode.Scratch.Set "relearnSubPages" .node.Pages }}
- {{- if .node.IsHome}}
+ {{- if .node.IsHome }}
{{- $currentNode.Scratch.Set "relearnSubPages" .node.Sections }}
- {{- else if .node.Sections}}
+ {{- else if .node.Sections }}
{{- $currentNode.Scratch.Set "relearnSubPages" (.node.Pages | union .node.Sections) }}
- {{- end}}
+ {{- end }}
{{- $pages := ($currentNode.Scratch.Get "relearnSubPages") }}
{{- if eq .Site.Params.ordersectionsby "title"}}
diff --git a/layouts/shortcodes/children.html b/layouts/shortcodes/children.html
index eb5e6b01b1..8d15dd2cd7 100644
--- a/layouts/shortcodes/children.html
+++ b/layouts/shortcodes/children.html
@@ -7,20 +7,13 @@
{{- $containerstyle := .Get "containerstyle" | default "ul" }}
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
- {{- .Scratch.Set "pages" .Page.Pages }}
-
+ {{- $pages := .Page.Pages }}
{{- if .Page.IsHome }}
-
- {{- $rootPage := where .Page.Pages "Dir" "" }}
- {{- .Scratch.Set "pages" (.Page.Sections | union $rootPage)}}
- {{- else }}
- {{- if .Page.Sections}}
- {{- .Scratch.Set "pages" (.Page.Pages | union .Page.Sections) }}
- {{- end }}
+ {{- $pages = .Page.Sections }}
+ {{- else if .Page.Sections}}
+ {{- $pages = (.Page.Pages | union .Page.Sections) }}
{{- end }}
- {{- $pages := (.Scratch.Get "pages") }}
-
{{- if eq $sortTerm "weight" }}
{{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
{{- else if or (eq $sortTerm "name") (eq $sortTerm "title") }}
@@ -69,14 +62,13 @@
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
{{- end }}
- {{- if .Sections }}
- {{- .Scratch.Set "pages" (.Pages | union .Sections) }}
- {{- else }}
- {{- .Scratch.Set "pages" .Pages }}
+ {{- $pages := .Page.Pages }}
+ {{- if .Page.IsHome }}
+ {{- $pages = .Page.Sections }}
+ {{- else if .Page.Sections}}
+ {{- $pages = (.Page.Pages | union .Page.Sections) }}
{{- end }}
- {{- $pages := (.Scratch.Get "pages") }}
-
{{- if eq $.sortTerm "weight" }}
{{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
{{- else if or (eq $.sortTerm "name") (eq $.sortTerm "title") }}