{{ template "section-tree-nav" (dict "ctx" . "section" .) }} {{ define "section-tree-nav" }} {{ $pages := (union .section.Pages .section.Sections) }} {{ with $.ctx.Site.Params.language_alternatives }} {{ range . }} {{ with (where $.section.Translations ".Lang" . ) }} {{ $p := index . 0 }} {{ $pages = $pages | lang.Merge (union $p.Pages $p.Sections) }} {{ end }} {{ end }} {{ end }} {{ $sections := where $pages.ByWeight ".Params.toc_hide" "!=" true }} {{ range $sections }} {{ if .IsPage }} {{ template "section-tree-nav-page" (dict "ctx" $.ctx "page" .) }} {{ else }} {{ template "section-tree-nav-section" (dict "ctx" $.ctx "section" .) }} {{ end }} {{ end }} {{ end }} {{ define "section-tree-nav-section" }}
{{ if ge (len .section.Content) 10 }} {{/* The section page has content, so link to it. */}} {{ $isForeignLanguage := (ne .section.Lang $.ctx.Lang)}} {{ end }} {{ template "section-tree-nav" . }}
{{ end }} {{ define "section-tree-nav-page" }} {{ $isForeignLanguage := (ne .page.Lang $.ctx.Lang)}} {{ end }}