initial mentioned_in and isin menus...

This commit is contained in:
Marcell Mars 2025-04-03 16:24:20 +02:00
parent 53fd25a880
commit 80f451e842
6 changed files with 50 additions and 11 deletions

View file

@ -0,0 +1,2 @@
{{- $sectionMap := site.Data.sandpointsnamegraph -}}{{- return index $sectionMap
. -}}

View file

@ -0,0 +1,9 @@
{{- $pluralSection := . -}}
{{- $sectionMap := site.Data.sandpointsnamegraph -}}
{{- $section := "" -}}
{{- range $singular, $plural := $sectionMap -}}
{{- if eq $plural $pluralSection -}}
{{- $section = $singular -}}
{{- end -}}
{{- end -}}
{{- return $section -}}

View file

@ -1,6 +1,5 @@
{{ $currentPage := . }}
{{ $currentPageGraph := $currentPage.Store.Get "graph"}}
<p>{{ printf "%#v" $currentPageGraph }}</p>
{{ $data := (dict "allPages" site.AllPages "currentPage" $currentPage)}}
{{- with (templates.Defer (dict "data" $data)) -}}
@ -23,8 +22,6 @@
{{- end -}}
{{- end -}}
{{- printf "%s is in %#v" .currentPage.RelPermalink (.currentPage.Store.Get "isin") -}}
{{- printf "%s mentioned in %#v" .currentPage.RelPermalink (.currentPage.Store.Get "mentioned_in") -}}
{{- warnf "%s is in %#v" .currentPage.RelPermalink (.currentPage.Store.Get "isin") -}}
{{- warnf "%s mentioned in %#v" .currentPage.RelPermalink (.currentPage.Store.Get "mentioned_in") -}}
{{- partial "menu_isin.html" (dict "currentPage" .currentPage "isin" (.currentPage.Store.Get "isin")) -}}
{{- partial "mentioned_in.html" (dict "currentPage" .currentPage "mentioned_in" (.currentPage.Store.Get "mentioned_in")) -}}
{{- end -}}

View file

@ -0,0 +1,12 @@
<div class="has hasmentionedin">
<div class="hassup">mentioned in</div>
<div>
{{- $currentPage := .currentPage -}} {{- range .mentioned_in -}}{{- $p :=
site.GetPage . -}}
<div class="">
<a href="{{- $p.RelPermalink -}}">{{- $p.LinkTitle -}}</a>
<p>{{- printf "RELREF: %#v" (relref $currentPage $p.RelPermalink) -}}</p>
</div>
{{- end -}}
</div>
</div>

View file

@ -0,0 +1,24 @@
{{- $sections := slice -}}
{{- $currentPage := .currentPage -}}
{{- $isin := .isin -}}
{{- range $isin -}}
{{- $p := site.GetPage . -}}
{{- $section := trim $p.FirstSection.RelPermalink "//" -}}
{{- $sections = uniq ($sections | append $section) -}}
{{- end -}}
<div class="has hashas">
{{- range $sections -}}
{{- $section := . -}}
<div class="hassup">is in&nbsp;{{- partial "GetPluralSectionName.html" $section -}}</div>
<div class="afterhas">
{{- range $isin -}}
{{- $p := site.GetPage . -}}
{{- if eq (trim $p.FirstSection.RelPermalink "//") $section -}}
<div>
<a href="{{- $p.RelPermalink -}}" >{{- $p.LinkTitle -}}</a >
</div>
{{- end -}}
{{- end -}}
</div>
{{- end -}}
</div>

View file

@ -1,5 +1,4 @@
{{- $currentPage := . -}}
{{- $sectionMap := site.Data.sandpointsnamegraph -}}
{{ $currentEntry := dict }}
@ -10,11 +9,7 @@
{{- $sectionsSlice := split (strings.TrimPrefix "_" $sectionMaybe) "_" -}}
{{- if gt (len $sectionsSlice) 0 -}}
{{- $pluralSection := index (last 1 $sectionsSlice) 0 -}}
{{- range $singular, $plural := $sectionMap -}}
{{- if eq $plural $pluralSection -}}
{{- $section = $singular -}}
{{- end -}}
{{- end -}}
{{- $section = partial "GetSingularSectionName.html" $pluralSection -}}
{{- where site.Pages "Section" $section -}}
{{- $menuPrefix = "no-prefix" -}}
{{- if gt (len $sectionsSlice) 1 -}}