diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index effc0c9..4c82d45 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -25,6 +25,6 @@ {{ end }} {{end}} -{{ $counter }} {{ .Text | safeHTML }} {{ .Page.Store.Get "level" }} +{{ $counter }} {{ .Text | safeHTML }} {{ .Page.Store.Get "level" }} {{ .Page.Store.Set "previousLevel" .Level }} diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 789f1ab..f2820a7 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,16 +1,27 @@ {{- $currentPage := .Page -}} -{{- $u := urls.Parse .Destination -}} +{{- $text := .Text -}} +{{- $destination := .Destination -}} + +{{- $u := urls.Parse $destination -}} {{- if not $u.Scheme -}} {{- with site.GetPage .Destination -}} {{- $backlinks := .Store.Get "backlinks" | default slice -}} {{- $backlinks := $backlinks|append $currentPage.RelPermalink -}} {{- .Store.Set "backlinks" ($backlinks|uniq) -}} + {{- if not $text -}} + {{- $text = .LinkTitle -}} + {{- end -}} + {{- .Section -}}⁄{{- $text -}} {{- end -}} + {{- if hasPrefix $destination "/library" -}} + {{- $bib := strings.TrimPrefix "/library/" $destination -}} + {{- $b := index site.Data.books.catalog $bib -}} + {{- if not $text -}} + {{- $text = $b.title|default "" -}} + {{- end -}} + library⁄{{- $text -}} + {{- end -}} +{{- else -}} + www⁄{{- with .Text }}{{ . }}{{- end -}} {{- end -}} - - {{- with .Text }}{{ . }}{{ end -}} - {{- /* chomp trailing newline */ -}} diff --git a/layouts/partials/deferred_page_graph.html b/layouts/partials/deferred_page_graph.html index f95cfe3..0595104 100644 --- a/layouts/partials/deferred_page_graph.html +++ b/layouts/partials/deferred_page_graph.html @@ -1,6 +1,5 @@ {{ $currentPage := . }} {{ $currentPageGraph := $currentPage.Store.Get "graph"}} - {{ $data := (dict "allPages" site.AllPages "currentPage" $currentPage)}} {{- with (templates.Defer (dict "data" $data)) -}} {{ range $page := .allPages }} @@ -18,6 +17,15 @@ {{- $mentionedInPage.Store.Set "mentioned_in" ($mentionedIn|uniq) -}} {{- end -}} {{- end -}} - {{- partial "menu_isin.html" (dict "currentPage" .currentPage "isin" (.currentPage.Store.Get "isin")) -}} - {{- partial "menu_mentioned_in.html" (dict "currentPage" .currentPage "mentioned_in" (.currentPage.Store.Get "mentioned_in")) -}} + {{- $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) -}} {{- end -}} diff --git a/layouts/partials/graph-menu.html b/layouts/partials/graph-menu.html index 11054b0..046866a 100644 --- a/layouts/partials/graph-menu.html +++ b/layouts/partials/graph-menu.html @@ -4,7 +4,11 @@
{{- with $cursiveMenuPrefix -}}{{- . -}} {{- end -}} - {{- partial "GetPluralSectionName.html" $menuSection -}}⁄ + {{- if gt ($pagePaths|len) 1 -}} + {{- partial "GetPluralSectionName.html" $menuSection -}} + {{- else -}} + {{- $menuSection -}} + {{- end -}}⁄