initial mentioned_in and isin menus...
This commit is contained in:
parent
53fd25a880
commit
80f451e842
6 changed files with 50 additions and 11 deletions
2
layouts/partials/GetPluralSectionName.html
Normal file
2
layouts/partials/GetPluralSectionName.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{- $sectionMap := site.Data.sandpointsnamegraph -}}{{- return index $sectionMap
|
||||
. -}}
|
9
layouts/partials/GetSingularSectionName.html
Normal file
9
layouts/partials/GetSingularSectionName.html
Normal 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 -}}
|
|
@ -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 -}}
|
||||
|
|
12
layouts/partials/mentioned_in.html
Normal file
12
layouts/partials/mentioned_in.html
Normal 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>
|
24
layouts/partials/menu_isin.html
Normal file
24
layouts/partials/menu_isin.html
Normal 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 {{- 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>
|
|
@ -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 -}}
|
||||
|
|
Loading…
Add table
Reference in a new issue