{{ define "book-menu" }}
{{- $first := false -}}
{{- $current_node := .current_node -}}
{{- $is_root := .is_root -}}
{{- $order_by := .order_by -}}
{{ $icon := "" }}
{{ with .sect }}
{{ if .IsSection }}
{{ if not $is_root }}
{{- $first = (eq $current_node.FirstSection.Type "book") | and (eq $current_node.FirstSection .) -}}
{{ end }}
{{- safeHTML $current_node.FirstSection.Params.pre_nav -}}
{{/* Get section icon. */}}
{{ $pack := or .Params.icon_pack "fas" }}
{{ $pack_prefix := $pack }}
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
{{ $pack_prefix = "fa" }}
{{ end }}
{{ with .Params.icon }}
{{- if eq $pack "emoji" -}}
{{- . | emojify -}}
{{- else if eq $pack "custom" -}}
{{- $svg_icon := resources.Get (printf "media/icons/%s.svg" .) -}}
{{- if $svg_icon -}}
{{ $icon = printf "" $svg_icon.RelPermalink . }}
{{- end -}}
{{- else -}}
{{ $icon = printf "" $pack $pack_prefix . }}
{{- end -}}
{{ end }}
{{ if $first }}