mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-22 03:19:25 +00:00
#440L Adjust bookHref, check .Content again, add redirect
This commit is contained in:
parent
c2014a08a5
commit
1852b16d93
@ -97,7 +97,7 @@ hugo server --minify --theme hugo-book
|
|||||||
By default, the theme will render pages from the `content/docs` section as a menu in a tree structure.
|
By default, the theme will render pages from the `content/docs` section as a menu in a tree structure.
|
||||||
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu.
|
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu.
|
||||||
|
|
||||||
### Leaf bundle menu (Deprecated)
|
### Leaf bundle menu (Deprecated, to be removed in June 2022)
|
||||||
|
|
||||||
You can also use leaf bundle and the content of its `index.md` file as menu.
|
You can also use leaf bundle and the content of its `index.md` file as menu.
|
||||||
Given you have the following file structure:
|
Given you have the following file structure:
|
||||||
@ -179,6 +179,7 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
|
|||||||
|
|
||||||
# (Optional, default none) Set leaf bundle to render as side menu
|
# (Optional, default none) Set leaf bundle to render as side menu
|
||||||
# When not specified file structure and weights will be used
|
# When not specified file structure and weights will be used
|
||||||
|
# Deprecated, to be removed in June 2022
|
||||||
BookMenuBundle = '/menu'
|
BookMenuBundle = '/menu'
|
||||||
|
|
||||||
# (Optional, default docs) Specify section of content to render as menu
|
# (Optional, default docs) Specify section of content to render as menu
|
||||||
@ -260,6 +261,9 @@ bookComments = true
|
|||||||
|
|
||||||
# (Optional) Set to 'false' to exclude page from search index.
|
# (Optional) Set to 'false' to exclude page from search index.
|
||||||
bookSearchExclude = true
|
bookSearchExclude = true
|
||||||
|
|
||||||
|
# (Optional) Set explicit href attribute for this page in a menu (if BookMenuBundle not set)
|
||||||
|
bookHref = ''
|
||||||
```
|
```
|
||||||
|
|
||||||
### Partials
|
### Partials
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
{"Target":"book.min.46181bc93375ba932026e753b37c40e6ff8bb16a9ef770c78bcc663e4577b1ba.css","MediaType":"text/css","Data":{"Integrity":"sha256-RhgbyTN1upMgJudTs3xA5v+LsWqe93DHi8xmPkV3sbo="}}
|
{"Target":"book.min.82c5dbd23447cee0b4c2aa3ed08ce0961faa40e1fa370eee4f8c9f02e0d46b5f.css","MediaType":"text/css","Data":{"Integrity":"sha256-gsXb0jRHzuC0wqo+0Izglh+qQOH6Nw7uT4yfAuDUa18="}}
|
@ -4,6 +4,10 @@
|
|||||||
<meta name="theme-color" content="#FFFFFF">
|
<meta name="theme-color" content="#FFFFFF">
|
||||||
<meta name="color-scheme" content="light dark">
|
<meta name="color-scheme" content="light dark">
|
||||||
|
|
||||||
|
{{- with .Page.Params.BookHref -}}
|
||||||
|
<meta http-equiv="Refresh" content="0; url='{{ . }}'" />
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{- template "_internal/opengraph.html" . -}}
|
{{- template "_internal/opengraph.html" . -}}
|
||||||
|
|
||||||
<title>{{ partial "docs/html-head-title" . }}</title>
|
<title>{{ partial "docs/html-head-title" . }}</title>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
||||||
{{ template "book-section-children" (dict "Section" . "CurrentPage" $.CurrentPage) }}
|
{{ template "book-section-children" (dict "Section" . "CurrentPage" $.CurrentPage) }}
|
||||||
</li>
|
</li>
|
||||||
{{ else if and .IsPage }}
|
{{ else if and .IsPage .Content }}
|
||||||
<li>
|
<li>
|
||||||
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
{{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
||||||
</li>
|
</li>
|
||||||
@ -28,19 +28,19 @@
|
|||||||
{{ $current := eq .CurrentPage .Page }}
|
{{ $current := eq .CurrentPage .Page }}
|
||||||
{{ $ancestor := .Page.IsAncestor .CurrentPage }}
|
{{ $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 }} />
|
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
|
||||||
<label for="section-{{ md5 .Page }}" class="flex justify-between">
|
<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 }}">
|
<a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
|
||||||
{{- partial "docs/title" .Page -}}
|
{{- partial "docs/title" .Page -}}
|
||||||
</a>
|
</a>
|
||||||
</label>
|
</label>
|
||||||
{{ else if .Page.Content }}
|
{{ else if .Page.Params.BookHref }}
|
||||||
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }} active{{ end }}">
|
<a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
|
||||||
{{- partial "docs/title" .Page -}}
|
{{- partial "docs/title" .Page -}}
|
||||||
</a>
|
</a>
|
||||||
{{ else if .Page.Params.bookHref }}
|
{{ else if .Page.Content }}
|
||||||
<a href="{{ .Page.Params.bookHref }}" role="button" class="{{ if $current }} active{{ end }}" target="_blank" rel="noopener">
|
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
|
||||||
{{- partial "docs/title" .Page -}}
|
{{- partial "docs/title" .Page -}}
|
||||||
</a>
|
</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
Loading…
Reference in New Issue
Block a user