diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index b23be44..88f40b0 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -8,8 +8,5 @@ {{- block "main" . }}{{- end -}} {{- partialCached "footer.html" . -}} - {{ if eq .RelPermalink "/mirror/ubu/" }} - {{ partial "deferred_global_graph.html" . }} - {{end}} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 7b8680b..846938b 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,5 +1,6 @@ {{ define "main" }} {{ partial "single-page-graph.html" . }} +

{{ partial "deferred_page_graph.html" . }}

{{ .Title }}

{{ .Content }}

diff --git a/layouts/partials/deferred_global_graph.html b/layouts/partials/deferred_global_graph.html deleted file mode 100644 index 8245c53..0000000 --- a/layouts/partials/deferred_global_graph.html +++ /dev/null @@ -1,4 +0,0 @@ -{{- with templates.Defer -}} - {{- $globalGraph := site.Home.Store.Get "graph" -}} - {{- warnf "%s" ($globalGraph | jsonify (dict "prefix" " " "indent" " ")) -}} -{{- end -}} diff --git a/layouts/partials/deferred_page_graph.html b/layouts/partials/deferred_page_graph.html new file mode 100644 index 0000000..7afd82a --- /dev/null +++ b/layouts/partials/deferred_page_graph.html @@ -0,0 +1,8 @@ +{{ $currentPage := . }} +{{- with templates.Defer -}} + {{ $pageGraph := $currentPage.Store.Get "graph"}} + {{ $pageIsIn := $currentPage.Store.Get "isin"}} + {{/* warnf "DEFERRED: %#v" $pageGraph */}} +

{{ printf "%#v" $pageGraph }}

+

{{ printf "%#v" $pageIsIn }}

+{{- end -}} diff --git a/layouts/partials/single-page-graph.html b/layouts/partials/single-page-graph.html index a87b70a..53fe189 100644 --- a/layouts/partials/single-page-graph.html +++ b/layouts/partials/single-page-graph.html @@ -24,11 +24,15 @@ {{- if reflect.IsSlice $pages -}} {{- range $page := $pages -}} {{- with site.GetPage (printf "%s/%s" $section $page) -}} - {{- $currentPrefix := index $currentEntry $currentPage.RelPermalink | default (dict $menuPrefix slice) -}} - {{- $currentPages := index $currentPrefix $menuPrefix | default (slice .RelPermalink) -}} + + {{- $currentPages := index $currentEntry $menuPrefix | default slice -}} {{- $currentPages = $currentPages | append .RelPermalink -}} - {{- $currentPrefix = merge $currentPrefix (dict $menuPrefix (uniq $currentPages)) -}} - {{- $currentEntry = merge $currentEntry (dict $currentPage.RelPermalink $currentPrefix) -}} + {{- $currentEntry = merge $currentEntry (dict $menuPrefix $currentPages) -}} + + {{- $isInSlice := .Store.Get "isin"|default slice -}} + {{ warnf "%s: %#v" .RelPermalink $isInSlice }} + {{- $isInSlice = $isInSlice | append $currentPage.RelPermalink -}} + {{ .Store.Set "isin" (uniq $isInSlice) }} {{- end -}} {{- end -}} {{- end -}} @@ -36,5 +40,5 @@ {{- end -}} {{- end -}} {{- if gt (len $currentEntry) 0 -}} - {{- site.Home.Store.SetInMap "graph" $currentPage.RelPermalink $currentEntry -}} + {{- $currentPage.Store.Set "graph" $currentEntry -}} {{- end -}}