Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vjeantet/hugo-theme-docport.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvjeantet <valere.jeantet@gmail.com>2020-08-19 13:58:03 +0300
committervjeantet <valere.jeantet@gmail.com>2020-08-19 13:58:03 +0300
commitf879b2a6882fbb80132112df382efc1f2983f222 (patch)
tree3ea90177b6db5221e426d7d17ca953f7900d006f /layouts
parentdfa890967eebbd0cc057fb99dc1cf61c847083ed (diff)
new frontmatter option "tab"
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/_menu.html16
-rw-r--r--layouts/partials/body-article-content.html59
2 files changed, 50 insertions, 25 deletions
diff --git a/layouts/partials/_menu.html b/layouts/partials/_menu.html
index ec82735..7a477e8 100644
--- a/layouts/partials/_menu.html
+++ b/layouts/partials/_menu.html
@@ -16,9 +16,12 @@
{{- define "section-tree-nav" }}
{{- $currentNode := .currentnode }}
{{- $level := .level }}
+{{- $maxlevel := 99 }}
+{{if lt $level $maxlevel }}
{{- with .sect}}
{{- if and .IsSection (or (not .Params.hidden) $.showhidden)}}
{{- $numberOfPages := (len .Sections) }}
+ {{- $numberOfPages := (len (where .Sections "Params.tab" "ne" "true")) }}
{{- safeHTML .Params.head}}
<li data-nav-id="{{.Permalink}}" class="dd-item
{{- if .IsAncestor $currentNode}} parent{{end}}
@@ -32,10 +35,10 @@
{{if eq $menuTitle ""}}{{$menuTitle = .CurrentSection}}{{end}}
{{if gt $level 0 }}
- <a href="{{ .RelPermalink}}">{{safeHTML .Params.Pre}}{{$menuTitle}}{{safeHTML .Params.Post}}</a>
+ <a href="{{ .RelPermalink}}">{{safeHTML .Params.Pre}}{{$menuTitle}}{{safeHTML .Params.Post}}</a>
{{end}}
- {{- if ne $numberOfPages 0 }}
+ {{- if and (ne $numberOfPages 0) (lt (add $level 1) $maxlevel) }}
{{- if or (.IsAncestor $currentNode) (.Params.alwaysopen) }}
<i class="material-icons ddexp keyboard_arrow_down"></i>
{{- else -}}
@@ -44,10 +47,8 @@
{{- end}}
{{if eq $level 0 }}
- <a href="{{ .RelPermalink}}">{{safeHTML .Params.Pre}}{{$menuTitle}}{{safeHTML .Params.Post}}</a>
+ <a href="{{ .RelPermalink}}">{{safeHTML .Params.Pre}}{{$menuTitle}}{{safeHTML .Params.Post}}</a>
{{end}}
-
-
{{- if ne $numberOfPages 0 }}
<ul>
@@ -70,7 +71,9 @@
{{- range $pages.ByWeight }}
{{- if and .Params.hidden (not $.showhidden) }}
{{- else}}
- {{ if eq .Kind "section" }}
+ {{ if and (eq .Kind "section") (not .Params.tab ) }}
+
+
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "level" (add $level 1)}}
{{- end}}
{{- end}}
@@ -79,6 +82,7 @@
</ul>
{{- end}}
</li>
+ {{- end}}
{{- end}}
{{- end}}
{{- end}}
diff --git a/layouts/partials/body-article-content.html b/layouts/partials/body-article-content.html
index d9ae492..de0ab66 100644
--- a/layouts/partials/body-article-content.html
+++ b/layouts/partials/body-article-content.html
@@ -9,31 +9,52 @@
{{end}}
<!-- FIN FIL D'ARIANE -->
+ <!-- TITRE -->
{{if not .Params.layout }}
{{$pagetitle := .Title}}
{{if eq $pagetitle ""}}{{$pagetitle = .File.BaseFileName}}{{end}}
- <h1>{{.CurrentSection.Title}}
- {{if .IsPage }}<span>{{$pagetitle}}</span>{{end}}
- </h1>
- {{ if gt (len .CurrentSection.Pages) 0}}
- {{- $cPage := . }}
- <nav class="subpages">
- {{- range .CurrentSection.Pages.ByWeight }}
- {{- if not .Params.hidden }}
- {{- if eq .Kind "page" }}
- {{$pagetitle := .Title}}
- {{if eq $pagetitle ""}}{{$pagetitle = .File.BaseFileName}}{{end}}
- <li {{if eq . $cPage}}class="active"{{- end}}>
- <a title="$pagetitle" href="{{ .RelPermalink}}">{{safeHTML .Params.Pre}}{{$pagetitle}}{{safeHTML .Params.Post}}</a>
- </li>
- {{- end}}
- {{- end}}
- {{- end}}
- </nav>
+
+ {{ $cPage := .}}
+ {{ $elements := (where .Sections "NONONO" false) }}
+ {{ $isSubPage := .Params.tab }}
+ {{ $subpages := (where (where (where .Sections.ByWeight "Params.tab" true) "Params.hidden" "ne" true ) "Kind" "section")}}
+ {{ $pages := (where (where .CurrentSection.Pages.ByWeight "Kind" "page") "Params.hidden" "ne" true ) }}
+
+ {{if $isSubPage }}
+ <h1>{{.Parent.Title}}<span>{{$pagetitle}}</span></h1>
+ {{else}}
+ <h1>{{.CurrentSection.Title}}{{if .IsPage }}<span>{{$pagetitle}}</span>{{end}}</h1>
+ {{end}}
+
+ {{if gt (len $subpages) 0}} <!-- section has subpage -->
+ {{ $elements = $subpages }}
+ {{else if $isSubPage }} <!-- Section is subpage -->
+ {{ $elements = (where (where .Parent.Sections.ByWeight "Params.tab" true) "Params.hidden" "ne" true ) }}
+ {{else if gt (len $pages) 0}} <!-- Section has pages -->
+ {{ $elements = $pages }}
+ {{else}}
+ <!-- section has no subpage and is not subpage -->
{{end}}
+
+ {{ if gt (len $elements) 0}}
+ <nav class="subpages">
+ {{- range $elements}}
+ {{- if not .Params.hidden }}
+ {{$pagetitle := .Title}}
+ {{if eq $pagetitle ""}}{{$pagetitle = .File.BaseFileName}}{{end}}
+ <li {{if eq . $cPage}}class="active"{{- end}}>
+ <a title="$pagetitle" href="{{ .RelPermalink}}">{{safeHTML .Params.Pre}}{{$pagetitle}}{{safeHTML .Params.Post}}</a>
+ </li>
+ {{- end}}
+ {{- end}}
+ </nav>
+ {{ end }}
+
+
{{else}}
<h1>{{.Title}}</h1>
{{end}}
+ <!-- FIN TITRE -->
{{end}}
<div class="content">
{{- with .Content -}}
@@ -54,7 +75,7 @@
-
+
{{ define "breadcrumbnav" }}
{{ if .p1.Parent }}