changes in templates so has_sessions/topics now requires the full markdown file name

This commit is contained in:
Marcell Mars 2020-03-21 02:50:40 +01:00
parent 673c687ac9
commit 7091f52791
3 changed files with 36 additions and 43 deletions

View File

@ -21,8 +21,8 @@
<label for="toggly" class="sidebar-title mb-1" tabindex="1">▒▒ has topics ▽</label>
<div class="hiddendiv">
<ul class="mt-4">
{{ range split .Params.has_topics "," }}
{{ with $.GetPage (printf "%s%s" "/topic/" (trim . " ")) }}
{{ range .Params.has_topics }}
{{ with $.GetPage (printf "%s%s" "/topic/" . ) }}
<li><a class="sidebar-list text-base" href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">> {{ .Title }}</a></li>
{{ end }}
{{ end }}

View File

@ -1,47 +1,40 @@
{{ define "sidebar" }}
<div class="leading-none mb-12">
<span class="title-pretext">session ⦚ </span><span class="title-text pt-6">{{ .Title }}</span>
</div>
<div class="leading-none mb-12">
<span class="title-pretext">session ⦚ </span><span class="title-text pt-6">{{ .Title }}</span>
</div>
{{ if ne (trim .Page.TableOfContents "\n") "<nav id=\"TableOfContents\"></nav>" }}
<div class="ddmenu">
<input id="toggly-toc" type="checkbox" >
<label for="toggly-toc" class="sidebar-title" tabindex="1">▒▒ table of contents ▽</label>
<div class="hiddendiv">
<div class="mt-4">
{{ .Page.TableOfContents }}
</div>
</div>
</div>
{{ end }}
<div class="ddmenu">
<input id="toggly-isin" type="checkbox">
<label for="toggly-isin" class="sidebar-title mt-4 mb-1" tabindex="1">▒▒ is in ▽</label>
<div class="hiddendiv">
<ul class="mt-4">
{{ $currentNode := . }}
{{ range (where $.Site.RegularPages ".Section" "topic") }}
{{ if in .Params.has_sessions $currentNode.File.BaseFileName }}
<li><a class="sidebar-list text-base" href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">↖ topic ⦚ {{ .Title }}</a></li>
{{ else if eq $currentNode.Params.is_in .File.BaseFileName }}
<li><a class="sidebar-list text-base" href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">↖ topic ⦚ {{ .Title }}</a></li>
{{ end }}
{{ end }}
</ul>
{{ if ne (trim .Page.TableOfContents "\n") "<nav id=\"TableOfContents\"></nav>" }}
<div class="ddmenu">
<input id="toggly-toc" type="checkbox" >
<label for="toggly-toc" class="sidebar-title" tabindex="1">▒▒ table of contents ▽</label>
<div class="hiddendiv">
<div class="mt-4">
{{ .Page.TableOfContents }}
</div>
</div>
</div>
{{ end }}
<div class="ddmenu">
<input id="toggly-isin" type="checkbox">
<label for="toggly-isin" class="sidebar-title mt-4 mb-1" tabindex="1">▒▒ is in ▽</label>
<div class="hiddendiv">
<ul class="mt-4">
{{ $currentSession := . }}
{{ range where $.Site.RegularPages ".Section" "topic" }}
{{ if in .Params.has_sessions $currentSession.File.LogicalName }}
<li><a class="sidebar-list text-base" href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">↖ topic ⦚ {{ .Title }}</a></li>
{{ else if in $currentSession.Params.is_in .File.LogicalName }}
<li><a class="sidebar-list text-base" href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">↖ topic ⦚ {{ .Title }}</a></li>
{{ end }}
{{ end }}
</ul>
</div>
</div>
{{ end }}
{{define "main" }}
<article>
{{ if eq .Params.last_modified "top" }}
<div class="font-playfair italic text-base">Last modified: {{ dateFormat "Monday, Jan 2, 2006" .Lastmod }}</div>
{{ end }}
<div class="content-text">{{ .Content }}</div>
{{ if eq .Params.last_modified "bottom" }}
<div class="font-playfair italic text-base">Last modified: {{ dateFormat "Monday, Jan 2, 2006" .Lastmod }}</div>
{{ end }}
<div class="content-text">{{ .Content }}</div>
</article>
{{ end }}

View File

@ -21,11 +21,11 @@
<label for="toggly-sessions" class="sidebar-title mb-1" tabindex="1">▒▒ has sessions ▽</label>
<div class="hiddendiv">
<ul class="mt-4">
{{ range split .Params.has_sessions "," }}
{{ with $.GetPage (printf "%s%s" "/session/" (trim . " ")) }}
<li><a class="sidebar-list text-base" href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">> {{ .Title }}</a></li>
{{ end }}
{{ range .Params.has_sessions }}
{{ with $.GetPage (printf "%s%s" "/session/" . ) }}
<li><a class="sidebar-list text-base" href="{{ .RelPermalink }}{{ if eq hugo.Environment "offline" }}index.html{{ end }}">> {{ .Title }}</a></li>
{{ end }}
{{ end }}
</ul>
</div>
</div>