add sidebar title for custom names

This commit is contained in:
gonpombo8 2022-10-12 14:04:43 -03:00
parent 71177aa627
commit e6059bdc6b
No known key found for this signature in database
GPG Key ID: 6BE1C3CD0908CE48
3 changed files with 26 additions and 3 deletions

View File

@ -1,6 +1,5 @@
@import "_dcl-ui.scss";
@import "_home.scss";
html {
font-size: $font-size-base;
scroll-behavior: smooth;
@ -279,6 +278,7 @@ body[dir="rtl"] .book-menu {
position: relative;
margin: $padding-16 0;
border-bottom: 1px solid transparent;
width: 356px;
#book-search-input {
display: flex;
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) {
.book-search {
position: relative;

View File

@ -40,8 +40,8 @@
{{- partial "docs/title" .Page -}}
</a>
{{ else if .Page.Content }}
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}" id="{{ .Page.Kind }}">
{{- partial "docs/sidebar-title" .Page -}}
</a>
{{ else }}
<span>{{- partial "docs/title" .Page -}}</span>

View 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 }}