46 lines
1.4 KiB
Go Template
46 lines
1.4 KiB
Go Template
{{define "submenu"}}
|
|
{{if .Page.ChildrenMenu}}
|
|
<div class="subpage-listing">
|
|
{{$auth := .IsAuthenticated}}
|
|
{{$private := .Page.Private}}
|
|
{{range $index, $child := .Page.ChildrenMenu}}
|
|
{{if (eq $auth true)}}
|
|
<h2>{{ $child.Name }}</h2>
|
|
<p>{{ $child.Summary }} — <a href="{{ $child.Slug }}">Read more</a></p>
|
|
{{if eq $child.Private 0}}
|
|
<small>Public</small>
|
|
{{else if eq $child.Private 1}}
|
|
<small>Unlisted</small>
|
|
{{else}}
|
|
<small>Private</small>
|
|
{{end}}
|
|
{{ else if and (eq $private 0) (eq $child.Private 0) }}
|
|
<h2>{{ $child.Name }}</h2>
|
|
<p>{{ $child.Summary }} — <a href="{{ $child.Slug }}">Read more</a></p>
|
|
{{ else if and (eq $private 1) (ne $child.Private 2) }}
|
|
<h2>{{ $child.Name }}</h2>
|
|
<p>{{ $child.Summary }} — <a href="{{ $child.Slug }}">Read more</a></p>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
|
|
<!--
|
|
If Logged In :
|
|
- Show public, unlisted, private subpages
|
|
|
|
ELSE :
|
|
|
|
Parent page is public :
|
|
- Show subpages if public
|
|
- Hide subpages if unlisted
|
|
- Hide private pages
|
|
|
|
Parent page is unlisted :
|
|
- Show subpages if public
|
|
- Show subpages if unlisted
|
|
- Hide private pages
|
|
|
|
-->
|