feat: doc pages can have icons shown before the title

This commit is contained in:
Gabriele Musco 2023-12-10 08:58:07 +00:00
parent 118997fa92
commit b43d9fe2bb
2 changed files with 12 additions and 1 deletions

View file

@ -287,6 +287,12 @@ body[dir="rtl"] .book-menu {
will-change: transform, margin, opacity; will-change: transform, margin, opacity;
} }
.book-filetree-icon {
width: 16px;
height: 16px;
vertical-align: middle;
}
@media screen and (max-width: $mobile-breakpoint) { @media screen and (max-width: $mobile-breakpoint) {
#menu-control, #menu-control,
#toc-control { #toc-control {

View file

@ -3,7 +3,11 @@
Accepts Page as context Accepts Page as context
--> -->
{{ $title := "" }} {{ $title := "" }}
{{ $icon := "" }}
{{ if .Params.Icon }}
{{ $icon = printf "<img src=\"%s\" class=\"book-filetree-icon\" />" .Params.Icon }}
{{ end }}
{{ if .LinkTitle }} {{ if .LinkTitle }}
{{ $title = .LinkTitle }} {{ $title = .LinkTitle }}
{{ else if .Title }} {{ else if .Title }}
@ -14,4 +18,5 @@
{{ $title = .File.BaseFileName | humanize | title }} {{ $title = .File.BaseFileName | humanize | title }}
{{ end }} {{ end }}
{{ return $title }} {{ $out := printf "%s %s" $icon $title | safeHTML }}
{{ return $out }}