From b43d9fe2bbed161c9ebdb49c86353b5c78863913 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Sun, 10 Dec 2023 08:58:07 +0000 Subject: [PATCH 1/2] feat: doc pages can have icons shown before the title --- assets/_main.scss | 6 ++++++ layouts/partials/docs/title.html | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/assets/_main.scss b/assets/_main.scss index 7073e2b..826a06d 100644 --- a/assets/_main.scss +++ b/assets/_main.scss @@ -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 { diff --git a/layouts/partials/docs/title.html b/layouts/partials/docs/title.html index 83df5b6..19620bd 100644 --- a/layouts/partials/docs/title.html +++ b/layouts/partials/docs/title.html @@ -3,7 +3,11 @@ Accepts Page as context --> {{ $title := "" }} +{{ $icon := "" }} +{{ if .Params.Icon }} + {{ $icon = printf "" .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 }} From 5fcb0c09a86019fceca39bc0ed4b2632fad1b112 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Sun, 10 Dec 2023 09:16:12 +0000 Subject: [PATCH 2/2] fix: only use icon where applicable --- layouts/partials/docs/header.html | 2 +- layouts/partials/docs/menu-filetree.html | 8 ++++---- layouts/partials/docs/menu-hugo.html | 2 +- layouts/partials/docs/title-with-icon.html | 9 +++++++++ layouts/partials/docs/title.html | 7 +------ layouts/posts/list.html | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 layouts/partials/docs/title-with-icon.html diff --git a/layouts/partials/docs/header.html b/layouts/partials/docs/header.html index 089859c..38b0796 100644 --- a/layouts/partials/docs/header.html +++ b/layouts/partials/docs/header.html @@ -3,7 +3,7 @@ Menu - {{ partial "docs/title" . }} + {{ partial "docs/title-with-icon" . }}