mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2025-07-16 11:41:27 +00:00
add sidebar title for custom names
This commit is contained in:
parent
71177aa627
commit
e6059bdc6b
@ -1,6 +1,5 @@
|
|||||||
@import "_dcl-ui.scss";
|
@import "_dcl-ui.scss";
|
||||||
@import "_home.scss";
|
@import "_home.scss";
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
@ -279,6 +278,7 @@ body[dir="rtl"] .book-menu {
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: $padding-16 0;
|
margin: $padding-16 0;
|
||||||
border-bottom: 1px solid transparent;
|
border-bottom: 1px solid transparent;
|
||||||
|
width: 356px;
|
||||||
#book-search-input {
|
#book-search-input {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -391,6 +391,12 @@ body[dir="rtl"] .book-menu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media screen and (max-width: 991px) {
|
||||||
|
.book-search {
|
||||||
|
width: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: $mobile-breakpoint) {
|
@media screen and (min-width: $mobile-breakpoint) {
|
||||||
.book-search {
|
.book-search {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -40,8 +40,8 @@
|
|||||||
{{- partial "docs/title" .Page -}}
|
{{- partial "docs/title" .Page -}}
|
||||||
</a>
|
</a>
|
||||||
{{ else if .Page.Content }}
|
{{ else if .Page.Content }}
|
||||||
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
|
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}" id="{{ .Page.Kind }}">
|
||||||
{{- partial "docs/title" .Page -}}
|
{{- partial "docs/sidebar-title" .Page -}}
|
||||||
</a>
|
</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<span>{{- partial "docs/title" .Page -}}</span>
|
<span>{{- partial "docs/title" .Page -}}</span>
|
||||||
|
17
layouts/partials/docs/sidebar-title.html
Normal file
17
layouts/partials/docs/sidebar-title.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!--
|
||||||
|
Partial to generate page name from Title or File name.
|
||||||
|
Accepts Page as context
|
||||||
|
-->
|
||||||
|
{{ $title := "" }}
|
||||||
|
|
||||||
|
{{ if .Params.sidebartitle }}
|
||||||
|
{{ $title = .Params.sidebartitle }}
|
||||||
|
{{ else if .Title }}
|
||||||
|
{{ $title = .Title }}
|
||||||
|
{{ else if and .IsSection .File }}
|
||||||
|
{{ $title = path.Base .File.Dir | humanize | title }}
|
||||||
|
{{ else if and .IsPage .File }}
|
||||||
|
{{ $title = .File.BaseFileName | humanize | title }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ return $title }}
|
Loading…
Reference in New Issue
Block a user