global graph. not good
This commit is contained in:
parent
1331ed0e53
commit
21eefa76e9
5 changed files with 88 additions and 0 deletions
18
layouts/index.html
Normal file
18
layouts/index.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{- $homepage := .Site.Params.home -}}
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<title>{{ .Site.Title }}</title>
|
||||
<link rel="canonical" href="{{ $homepage | absURL }}" />
|
||||
<meta http-equiv="refresh" content="0; url={{ $homepage | absURL }}" />
|
||||
<script>
|
||||
window.location.href = "{{ $homepage | absURL }}";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
If you are not redirected automatically, follow this
|
||||
<a href="{{ $homepage | absURL }}">link</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
25
layouts/partials/breadcrumbs.html
Normal file
25
layouts/partials/breadcrumbs.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{- $home := .Page.GetPage .Site.Params.home -}}
|
||||
|
||||
<div class="header">
|
||||
<a
|
||||
title="{{ $home.Title }}'s Bibliotheke"
|
||||
href="{{ "library/BROWSE_LIBRARY.html" | relURL }}"
|
||||
class="bibliotheke"
|
||||
target="_blank"
|
||||
>
|
||||
<img src="{{ "images/bibliotheke.svg" | relURL }}" />
|
||||
</a>
|
||||
<div class="breadcrumbs">
|
||||
<a href="{{ $home.RelPermalink }}">
|
||||
<i>{{ $home.Title }}</i>
|
||||
</a>
|
||||
{{- if ne $home.Title .Page.Title -}}
|
||||
»
|
||||
<a href="{{ .Page.RelPermalink }}">
|
||||
<i>{{ .Page.Title }}</i>
|
||||
</a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<pre>{{ debug.Dump .Site.Params }}</pre>
|
4
layouts/partials/deferred_global_graph.html
Normal file
4
layouts/partials/deferred_global_graph.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{- with templates.Defer -}}
|
||||
{{- $globalGraph := site.Home.Store.Get "graph" -}}
|
||||
{{- warnf "%s" ($globalGraph | jsonify (dict "prefix" " " "indent" " ")) -}}
|
||||
{{- end -}}
|
40
layouts/partials/single-page-graph.html
Normal file
40
layouts/partials/single-page-graph.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
{{- $currentPage := . -}}
|
||||
{{- $sectionMap := site.Data.sandpointsnamegraph -}}
|
||||
|
||||
{{ $currentEntry := dict }}
|
||||
|
||||
{{- $menuPrefix := "" -}}
|
||||
{{- $section := "" -}}
|
||||
{{- range $sectionMaybe, $pages := $currentPage.Params -}}
|
||||
{{- if strings.Contains $sectionMaybe "_" -}}
|
||||
{{- $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 -}}
|
||||
{{- where site.Pages "Section" $section -}}
|
||||
{{- $menuPrefix = "no-prefix" -}}
|
||||
{{- if gt (len $sectionsSlice) 1 -}}
|
||||
{{- $menuPrefix = delimit (first (sub (len $sectionsSlice) 1) $sectionsSlice) " " -}}
|
||||
{{- else -}}
|
||||
{{- end -}}
|
||||
{{- 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 = $currentPages | append .RelPermalink -}}
|
||||
{{- $currentPrefix = merge $currentPrefix (dict $menuPrefix (uniq $currentPages)) -}}
|
||||
{{- $currentEntry = merge $currentEntry (dict $currentPage.RelPermalink $currentPrefix) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if gt (len $currentEntry) 0 -}}
|
||||
{{- site.Home.Store.SetInMap "graph" $currentPage.RelPermalink $currentEntry -}}
|
||||
{{- end -}}
|
1
layouts/shortcodes/include.html
Normal file
1
layouts/shortcodes/include.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ with site.GetPage (.Get 0) }} {{ .RenderShortcodes }} {{ end }}
|
Loading…
Add table
Reference in a new issue