Rework of main template, adds options for more fine customisation

This commit is contained in:
Alex Shpak
2020-01-24 00:07:47 +01:00
parent 2acd6ab280
commit ba5d38ad44
31 changed files with 161 additions and 110 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<h2 class="book-brand">
<a href="{{ .Site.BaseURL }}">
<a href="{{ .Site.BaseURL | relLangURL }}">
{{- with .Site.Params.BookLogo -}}
<img src="{{ . | relURL }}" alt="Logo" />
{{- end -}}
+10 -19
View File
@@ -1,33 +1,24 @@
<div class="book-footer justify-between">
{{ if .Site.IsMultiLingual }}
<div class="flex justify-between">
{{ if .Site.IsMultiLingual }}
{{ partial "docs/languages" . }}
{{ end }}
{{ end }}
{{ if and .GitInfo .Site.Params.BookRepo }}
{{ with .GitInfo }}
{{ if and .GitInfo .Site.Params.BookRepo }}
<div>
{{ $date := .AuthorDate.Local.Format (default "January 2, 2006" $.Site.Params.BookDateFormat) }}
<a class="flex align-center" href="{{ $.Site.Params.BookRepo }}/commit/{{ .Hash }}" title='{{ i18n "Last modified by" }} {{ .AuthorName }} | {{ $date }}' target="_blank">
{{ $date := .GitInfo.AuthorDate.Local.Format (default "January 2, 2006" .Site.Params.BookDateFormat) }}
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/commit/{{ .GitInfo.Hash }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
<img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="Calendar" />
<span>{{ $date }}</span>
</a>
</div>
{{ end }}
{{ end }}
{{ end }}
{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }}
{{ if and .File .Site.Params.BookRepo .Site.Params.BookEditPath }}
<div>
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ replace .File.Path "\\" "/" }}" target="_blank">
<a class="flex align-center" href="{{ .Site.Params.BookRepo }}/{{ .Site.Params.BookEditPath }}/{{ replace .File.Path "\\" "/" }}" target="_blank" rel="noopener">
<img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="Edit" />
<span>{{ i18n "Edit this page" }}</span>
</a>
</div>
{{ end }}
</div>
{{ if (default true (default .Site.Params.BookComments .Params.bookComments)) }}
<div class="book-comments">
{{ partial "docs/comments" . }}
</div>
{{ end }}
</div>
+11
View File
@@ -0,0 +1,11 @@
<div class="flex align-center justify-between">
<label for="menu-control">
<img src="{{ "svg/menu.svg" | relURL }}" class="book-icon" alt="Menu" />
</label>
<strong>{{ partial "docs/title" . }}</strong>
<label for="toc-control">
<img src="{{ "svg/toc.svg" | relURL }}" class="book-icon" alt="Table of Contents" />
</label>
</div>
+3 -3
View File
@@ -1,12 +1,12 @@
<nav id="BookMenu">
<nav>
{{ partial "docs/brand" . }}
{{ partial "docs/search" . }}
{{ partial "docs/inject/menu-before" . }}
{{ if .Site.Params.BookMenuBundle }}
{{ partial "docs/menu-bundle" . }}
{{ partial "docs/menu-bundle" . }}
{{ else }}
{{ partial "docs/menu-filetree" . }}
{{ partial "docs/menu-filetree" . }}
{{ end }}
{{ partial "docs/inject/menu-after" . }}
-8
View File
@@ -1,8 +0,0 @@
<header class="flex align-center justify-between book-header">
<label id="menu-control" for="menu-control">
<img src="{{ "svg/menu.svg" | relURL }}" class="book-icon" alt="Menu" />
</label>
<label id="toc-control" for="toc-control">
<strong>{{ partial "docs/title" . }}</strong>
</label>
</header>
+3 -3
View File
@@ -1,4 +1,4 @@
{{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }}
{{ $dateFormat := (default "January 2, 2006" .Site.Params.BookDateFormat) }}
{{ if or .Date .Params.tags }}
<div>
{{ with .Date}}
@@ -6,10 +6,10 @@
{{ end }}
{{ range $term, $_ := .Site.Taxonomies }}
{{ with $list := index $.Params $term }}
{{ with $list := $.Param $term }}
<div>
{{ range $n, $single := $list }}{{ if $n }}, {{ end }}
{{ with $.Site.GetPage (printf "/%s/%s" $term $single | urlize) }}
{{- with $.Site.GetPage (printf "/%s/%s" $term $single | urlize) }}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{- end }}
{{- end }}
-2
View File
@@ -1,4 +1,3 @@
<aside class="book-toc fixed">
<nav>
<ul>
{{ range $term, $_ := .Site.Taxonomies }}
@@ -17,4 +16,3 @@
{{ end }}
</ul>
</nav>
</aside>
+1 -10
View File
@@ -1,10 +1 @@
{{ $tocLevels := default (default 6 .Site.Params.BookToC) .Params.BookToC }}
{{ if and $tocLevels .Page.TableOfContents }}
<aside class="book-toc levels-{{$tocLevels}} fixed">
{{ with .Page.TableOfContents }}
<label id="toc-control" for="toc-control">
{{ . }}
</label>
{{ end }}
</aside>
{{ end }}
{{ .TableOfContents }}