mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-19 03:10:24 +00:00
print: don't print rest of site for shortcut links #283
This commit is contained in:
parent
5ff086306a
commit
3e489145e7
1 changed files with 21 additions and 16 deletions
|
@ -1,36 +1,41 @@
|
||||||
{{- $currentNode := . }}
|
{{- $currentNode := . }}
|
||||||
{{- $isActive := .IsHome }}
|
{{- $isActive := .IsHome }}
|
||||||
|
{{- $isShortcut := false }}
|
||||||
{{- $r_url := .RelPermalink }}
|
{{- $r_url := .RelPermalink }}
|
||||||
{{- with .Site.Menus.shortcuts }}
|
{{- with .Site.Menus.shortcuts }}
|
||||||
{{- range sort . "Weight" }}
|
{{- range sort . "Weight" }}
|
||||||
{{- $s_url := .URL | relLangURL }}
|
{{- $s_url := .URL | relLangURL }}
|
||||||
{{- if (eq $s_url $r_url) }}
|
{{- if (eq $s_url $r_url) }}
|
||||||
{{- $isActive = true }}
|
{{- $isShortcut = true }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $pages := .Site.Home.Sections }}
|
{{- $pages := .Site.Home.Sections }}
|
||||||
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
{{- $defaultOrdersectionsby := .Site.Params.ordersectionsby | default "weight" }}
|
||||||
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
|
{{- $currentOrdersectionsby := .Site.Home.Params.ordersectionsby | default $defaultOrdersectionsby }}
|
||||||
{{- if $isActive }}
|
{{- if $isShortcut }}
|
||||||
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
||||||
|
{{- else }}
|
||||||
|
{{- if $isActive }}
|
||||||
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
{{- template "section-print" dict "sect" . "currentnode" $currentNode }}
|
||||||
{{- if or .IsHome .Params.chapter $pages }}
|
{{- if or .IsHome .Params.chapter $pages }}
|
||||||
<section>
|
<section>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if eq $currentOrdersectionsby "title" }}
|
{{- if eq $currentOrdersectionsby "title" }}
|
||||||
{{- range $pages.ByTitle }}
|
{{- range $pages.ByTitle }}
|
||||||
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }}
|
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- range $pages.ByWeight }}
|
{{- range $pages.ByWeight }}
|
||||||
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }}
|
{{- template "section-tree-print" dict "sect" . "currentnode" $currentNode "isActive" $isActive }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if $isActive }}
|
{{- if $isActive }}
|
||||||
{{- if or .IsHome .Params.chapter $pages }}
|
{{- if or .IsHome .Params.chapter $pages }}
|
||||||
</section>
|
</section>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- define "section-tree-print" }}
|
{{- define "section-tree-print" }}
|
||||||
{{- $currentNode := .currentnode }}
|
{{- $currentNode := .currentnode }}
|
||||||
|
|
Loading…
Reference in a new issue