From e6059bdc6b6685ad8c590e6801ca72009664c5d3 Mon Sep 17 00:00:00 2001 From: gonpombo8 Date: Wed, 12 Oct 2022 14:04:43 -0300 Subject: [PATCH] add sidebar title for custom names --- assets/_main.scss | 8 +++++++- layouts/partials/docs/menu-filetree.html | 4 ++-- layouts/partials/docs/sidebar-title.html | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 layouts/partials/docs/sidebar-title.html diff --git a/assets/_main.scss b/assets/_main.scss index 0ba6519..50da224 100644 --- a/assets/_main.scss +++ b/assets/_main.scss @@ -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; diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html index 404f472..dd04718 100644 --- a/layouts/partials/docs/menu-filetree.html +++ b/layouts/partials/docs/menu-filetree.html @@ -40,8 +40,8 @@ {{- partial "docs/title" .Page -}} {{ else if .Page.Content }} - - {{- partial "docs/title" .Page -}} + + {{- partial "docs/sidebar-title" .Page -}} {{ else }} {{- partial "docs/title" .Page -}} diff --git a/layouts/partials/docs/sidebar-title.html b/layouts/partials/docs/sidebar-title.html new file mode 100644 index 0000000..314610e --- /dev/null +++ b/layouts/partials/docs/sidebar-title.html @@ -0,0 +1,17 @@ + +{{ $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 }}