couldhave tiers moved from singlebody template to metadata

master
Marcell Mars 3 years ago
parent 8006b53284
commit 085d6934bf

@ -6,6 +6,7 @@
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link rel='stylesheet' href='build/global.css'>
<!-- <link rel='stylesheet' href='build/bundle.css'> -->
<script defer src='../metadata/index.js'></script>
<script defer src='build/bundle.js'></script>
<title>edit{{- .Site.Title -}}</title>
</head>

@ -1 +1,20 @@
{{ define "main" }}METASP=[{{ range .Site.Sections }}{"section": "{{ with .File }}{{ trim .Dir "/" }}{{ end }}", "items": [{{ range .Pages }}"{{ .File.BaseFileName }}", {{ end }}]}, {{ end }}];{{ end }}
{{- define "main" -}}
{{ $sections := (slice) }}
{{ $tiers := (slice) }}
{{ range $.Site.Sections }}
{{ with .File }}
{{ $sections = $sections | append (strings.TrimSuffix "/" .Dir) }}
{{ end }}
{{ end }}
{{ $metasp := (dict) }}
{{ range $k, $v := $.Site.Data.sandpointsnamegraph }}
{{ if in $sections $k }}
{{ $tiers = (slice) }}
{{ range where $.Site.RegularPages "Section" $k }}
{{ $tiers = $tiers | append .File.LogicalName }}
{{ end }}
{{ $metasp = merge $metasp (dict $v (merge (dict "singular" $k) (dict "tiers" $tiers))) }}
{{ end }}
{{ end }}
{{ printf "METASP=%s;" (jsonify $metasp) }}
{{ end }}

@ -10,9 +10,6 @@
{{ $sandnamePlural := (slice) }}
{{ $couldHaveSection := "" }}
{{ $couldHave := (slice)}}
<div class="{{ $scratch.depth | default "crust" }}title"><span class="supt">{{ substr $currentDir 0 -1 }}{{ substr .Title 0 1 }}</span>{{ substr .Title 1 }}</div></div>
<div class="grid">
@ -26,9 +23,6 @@
{{ range $k, $v := $.Site.Data.sandpointsnamegraph }}
{{ $sandnamePlural = $sandnamePlural | append $v }}
{{ if eq $scratch.has $v }}
{{ $couldHaveSection = $k }}
{{ end }}
{{ end }}
{{ $paramsKeys := (slice) }}
{{ range $k, $v := $currentNode.Params }}
@ -100,11 +94,5 @@
{{- $vld := false -}}{{- range $k, $v := .Page.Params.keywords -}}{{- if eq $k 0 -}}{{- $vld = true -}}<div class="keywords"><span class="sup">keywords</span>{{- $v -}}{{- else -}},&nbsp;{{- $v -}}{{- end -}}{{- end -}}{{- with $vld -}}</div>{{- end -}}
{{ if $couldHaveSection }}
{{ range where .Site.RegularPages "Section" $couldHaveSection }}
{{ $couldHave = $couldHave | append .File.LogicalName }}
{{ end }}
{{ end }}
{{ $var := printf "repo={\"frontmatter\": %s, \"content\": %s, \"path\": \"%s\", \"relpermalink\": \"%s\", \"couldhave\": %s }" (jsonify .Params) (jsonify .RawContent) .File.Path .RelPermalink (jsonify $couldHave)| resources.FromString (printf "js/repo/%s.js" .File.UniqueID) }}
{{ $var := printf "repo={\"frontmatter\": %s, \"content\": %s, \"path\": \"%s\", \"relpermalink\": \"%s\" }" (jsonify .Params) (jsonify .RawContent) .File.Path .RelPermalink | resources.FromString (printf "js/repo/%s.js" .File.UniqueID) }}
{{ $dummy := $var.Permalink }}

Loading…
Cancel
Save