mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
Use index pages
This commit is contained in:
parent
b8d31039ec
commit
23e40c6b5b
4 changed files with 24 additions and 27 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
{{ partial "header.html" . }}
|
||||||
|
{{ .Content }}
|
||||||
|
{{ partial "footer.html" . }}
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
{{ if .Params.chapter }}
|
{{ if eq .Kind "section" }}
|
||||||
</div> <!-- end chapter-->
|
</div> <!-- end chapter-->
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<i class="fa fa-bars"></i>
|
<i class="fa fa-bars"></i>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{{ if and (not .Params.chapter) (.Params.toc) }}
|
{{ if and (ne .Kind "section") (.Params.toc) }}
|
||||||
<span id="toc-menu"><a href=""><i class="fa fa-list-alt"></i></a></span>
|
<span id="toc-menu"><a href=""><i class="fa fa-list-alt"></i></a></span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $type := .Type }}
|
{{ $type := .Type }}
|
||||||
|
@ -67,10 +67,10 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{ if .Params.chapter }}
|
{{ if eq .Kind "section" }}
|
||||||
<div id="chapter">
|
<div id="chapter">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div id="body-inner">
|
<div id="body-inner">
|
||||||
{{ if not .Params.chapter }}
|
{{ if ne .Kind "section" }}
|
||||||
<h1>{{.Title}}</h1>
|
<h1>{{.Title}}</h1>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -12,31 +12,27 @@
|
||||||
<div class="highlightable">
|
<div class="highlightable">
|
||||||
<ul class="topics">
|
<ul class="topics">
|
||||||
{{ $page := . }}
|
{{ $page := . }}
|
||||||
{{ if .Site.Params.menu }}
|
{{ $.Scratch.Set "_pages" (slice) }}
|
||||||
{{ $.Scratch.Set "menuItems" (slice) }}
|
{{ range $key, $value := .Site.Sections }}
|
||||||
{{ range $i, $key := .Site.Params.menu }}
|
{{ $.Scratch.Add "_pages" ($.Site.GetPage "section" $key) }}
|
||||||
{{ if isset $page.Site.Sections $key }}
|
{{ end }}
|
||||||
{{ $.Scratch.Add "menuItems" $key }}
|
{{ $.Scratch.Set "menuItems" (slice)}}
|
||||||
{{ else }}
|
{{ range $key, $value := sort ($.Scratch.Get "_pages") "Weight" }}
|
||||||
<li class="dd-item"><div class="notices warning"><p>
|
{{ $.Scratch.Add "menuItems" $value.Section }}
|
||||||
{{ printf "Unknown section '%s' found in site menu" $key }}
|
|
||||||
</p></div></li>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
{{ else }}
|
|
||||||
{{ $.Scratch.Set "menuItems" .Site.Sections }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $menuItems := $.Scratch.Get "menuItems" }}
|
{{ $menuItems := $.Scratch.Get "menuItems" }}
|
||||||
{{ range $i, $key := $menuItems }}
|
{{ range $i, $key := $menuItems }}
|
||||||
{{ if ne $key "" }}
|
{{ if ne $key "" }}
|
||||||
|
|
||||||
{{ if not $.Site.Params.menu }}
|
{{ $value := (index $page.Site.Sections $key) }}
|
||||||
{{ $.Scratch.Set "currentItem" (index $page.Site.Sections $i) }}
|
{{ with $index := $.Site.GetPage "section" $key }}
|
||||||
{{ else }}
|
{{ if .Title }}
|
||||||
{{ $.Scratch.Set "currentItem" (index $page.Site.Sections $key) }}
|
{{ $.Scratch.Set "first" $index }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $.Scratch.Set (index $value 0).Page }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $value := $.Scratch.Get "currentItem" }}
|
{{ $first := $.Scratch.Get "first" }}
|
||||||
{{ $first := (index $value 0).Page }}
|
|
||||||
|
|
||||||
<li class="dd-item {{ if eq $page.RelPermalink $first.RelPermalink }}active{{ end }} {{if in $page.RelPermalink $first.RelPermalink }}parent{{ end }}" data-nav-id="{{ $first.RelPermalink }}">
|
<li class="dd-item {{ if eq $page.RelPermalink $first.RelPermalink }}active{{ end }} {{if in $page.RelPermalink $first.RelPermalink }}parent{{ end }}" data-nav-id="{{ $first.RelPermalink }}">
|
||||||
<a href="{{ $first.RelPermalink }}">
|
<a href="{{ $first.RelPermalink }}">
|
||||||
|
@ -50,17 +46,15 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{{ if gt $value.Len 1}}
|
{{ if gt $value.Len 0}}
|
||||||
<ul>
|
<ul>
|
||||||
{{ range $k, $p := $value }}
|
{{ range $k, $p := $value }}
|
||||||
{{ if gt $k 0 }}
|
|
||||||
<li class="dd-item {{ if eq $page.RelPermalink $p.Page.RelPermalink }}active{{ end }}" data-nav-id="{{ $p.Page.RelPermalink }}">
|
<li class="dd-item {{ if eq $page.RelPermalink $p.Page.RelPermalink }}active{{ end }}" data-nav-id="{{ $p.Page.RelPermalink }}">
|
||||||
<a href="{{ $p.Page.RelPermalink }}">
|
<a href="{{ $p.Page.RelPermalink }}">
|
||||||
<span>{{ $p.Page.Title }} {{ if $page.Site.Params.showVisitedLinks}} <i class="fa fa-check read-icon"> {{ end }} </i></span>
|
<span>{{ $p.Page.Title }} {{ if $page.Site.Params.showVisitedLinks}} <i class="fa fa-check read-icon"> {{ end }} </i></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
</ul>
|
</ul>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue