SandpointsTheme/layouts/partials/deferred_page_graph.html

32 lines
1.5 KiB
HTML
Raw Normal View History

2025-03-30 16:02:18 +02:00
{{ $currentPage := . }}
{{ $currentPageGraph := $currentPage.Store.Get "graph"}}
{{ $data := (dict "allPages" site.AllPages "currentPage" $currentPage)}}
{{- with (templates.Defer (dict "data" $data)) -}}
2025-04-18 12:05:39 +02:00
{{ range $page := .allPages }}
{{- $pageGraph := $page.Store.Get "graph" -}}
{{- range $child := index $pageGraph "has" -}}
{{- $childPage := site.GetPage $child -}}
{{- $isinPages := $childPage.Store.Get "isin" | default slice -}}
{{- $isinPages = $isinPages | append $page.RelPermalink -}}
{{- $childPage.Store.Set "isin" ($isinPages|uniq) -}}
{{- end -}}
{{- range $kid := index $pageGraph "no-prefix" -}}
{{- $mentionedInPage := site.GetPage $kid -}}
{{- $mentionedIn := $mentionedInPage.Store.Get "mentioned_in" | default slice -}}
{{- $mentionedIn = $mentionedIn | append $page.RelPermalink -}}
{{- $mentionedInPage.Store.Set "mentioned_in" ($mentionedIn|uniq) -}}
{{- end -}}
{{- end -}}
2025-04-20 00:01:16 +02:00
{{- $isin := .currentPage.Store.Get "isin" -}}
{{- $backreferences := union (.currentPage.Store.Get "mentioned_in") (.currentPage.Store.Get "backlinks") -}}
{{- $complement := slice -}}
{{- with $backreferences -}}
{{- $complement = $backreferences -}}
{{- with $isin -}}
{{- $complement = complement $isin $backreferences -}}
{{- end -}}
{{- end -}}
{{- partial "menu_isin.html" (dict "currentPage" .currentPage "isin" $isin) -}}
{{- partial "menu_mentioned_in.html" (dict "currentPage" .currentPage "mentioned_in" $complement) -}}
2025-03-30 16:02:18 +02:00
{{- end -}}