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;
}
.book-filetree-icon {
width: 16px;
height: 16px;
vertical-align: middle;
}
@media screen and (max-width: $mobile-breakpoint) {
#menu-control,
#toc-control {

View file

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