#440L Adjust bookHref, check .Content again, add redirect

This commit is contained in:
Alex Shpak
2022-04-26 13:14:22 +02:00
parent c2014a08a5
commit 1852b16d93
5 changed files with 17 additions and 9 deletions
+6 -6
View File
@@ -15,7 +15,7 @@
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
{{ template "book-section-children" (dict "Section" . "CurrentPage" $.CurrentPage) }}
</li>
{{ else if and .IsPage }}
{{ else if and .IsPage .Content }}
<li>
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
</li>
@@ -28,19 +28,19 @@
{{ $current := eq .CurrentPage .Page }}
{{ $ancestor := .Page.IsAncestor .CurrentPage }}
{{ if .Page.Params.bookCollapseSection }}
{{ if .Page.Params.BookCollapseSection }}
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
<label for="section-{{ md5 .Page }}" class="flex justify-between">
<a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
</label>
{{ else if .Page.Content }}
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }} active{{ end }}">
{{ else if .Page.Params.BookHref }}
<a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
{{- partial "docs/title" .Page -}}
</a>
{{ else if .Page.Params.bookHref }}
<a href="{{ .Page.Params.bookHref }}" role="button" class="{{ if $current }} active{{ end }}" target="_blank" rel="noopener">
{{ else if .Page.Content }}
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
{{ else }}