Avoid printing unnecessary sections in sidelist
This commit is contained in:
parent
8d44df6fb9
commit
f5b7ee0a93
2 changed files with 16 additions and 34 deletions
|
@ -763,7 +763,7 @@ tbody {
|
||||||
|
|
||||||
/* side list */
|
/* side list */
|
||||||
.sidelist {
|
.sidelist {
|
||||||
display: none;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
li.sidelist>a {
|
li.sidelist>a {
|
||||||
|
@ -776,18 +776,6 @@ li.sidelist li a {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidelist.parent {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidelist.parent::before {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidelist.parent.active::before {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidelist li.sidelist {
|
.sidelist li.sidelist {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
{{ $currentNode := . }}
|
{{ $currentNode := . }}
|
||||||
<a class="d-block h4 back-btn" href="{{ .Site.BaseURL | relLangURL }}">{{ i18n "Back-home"}}</a>
|
<a class="d-block h4 back-btn" href="{{ .Site.BaseURL | relLangURL }}">{{ i18n "Back-home"}}</a>
|
||||||
{{range .Site.Home.Sections.ByWeight}}
|
{{range .Site.Home.Sections.ByWeight}}
|
||||||
|
{{ if eq . $currentNode.FirstSection }} {{/* print current section only */}}
|
||||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode}}
|
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -79,29 +81,21 @@
|
||||||
{{with .sect}}
|
{{with .sect}}
|
||||||
{{safeHTML .Params.head}}
|
{{safeHTML .Params.head}}
|
||||||
<li data-nav-id="{{.Permalink}}" title="{{.Title}}" class="sidelist
|
<li data-nav-id="{{.Permalink}}" title="{{.Title}}" class="sidelist
|
||||||
{{if .IsAncestor $currentNode }}parent{{end}}
|
{{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}">
|
||||||
{{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}
|
|
||||||
{{if .Params.alwaysopen}}parent{{end}}">
|
|
||||||
<a href="{{.Permalink}}">
|
<a href="{{.Permalink}}">
|
||||||
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
||||||
</a>
|
</a>
|
||||||
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
||||||
{{ if ne $numberOfPages 0 }}
|
{{ if ne $numberOfPages 0 }}
|
||||||
<ul>
|
<ul>
|
||||||
{{ $currentNode.Scratch.Set "pages" .Pages }}
|
{{ range .Pages.ByWeight }}
|
||||||
{{ if .Sections}}
|
|
||||||
{{ $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
|
|
||||||
{{end}}
|
|
||||||
{{ $pages := ($currentNode.Scratch.Get "pages") }}
|
|
||||||
|
|
||||||
{{ range $pages.ByWeight }}
|
|
||||||
{{ if and .Params.hidden (not $.showhidden) }}
|
{{ if and .Params.hidden (not $.showhidden) }}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode }}
|
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode }}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
|
{{ end }}
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
|
|
Loading…
Reference in a new issue