{{- $departure := "fonts/departure-mono/DepartureMono-Regular.woff2" | relURL }} {{- /* The sidebar's top-level items get their section's pixel icon, from data/sections.yaml, the list the docs' section cards use too, so the two always match. Each icon is a mask in the link's color, keyed to the section page's own address. The build fails when the list names a section or an icon that doesn't exist. */ -}} {{- $selectors := slice -}} {{- $rules := slice -}} {{- range $path, $name := hugo.Data.sections -}} {{- $page := site.GetPage (printf "/docs/%s" $path) -}} {{- if not $page }}{{ errorf "data/sections.yaml: no page docs/%s" $path }}{{ end -}} {{- $svg := resources.Get (printf "icons/%s.svg" $name) -}} {{- if not $svg }}{{ errorf "data/sections.yaml: no assets/icons/%s.svg for %s" $name $path }}{{ end -}} {{- $selector := printf `.hextra-sidebar-container a[href=%q] > span::before` $page.RelPermalink -}} {{- $selectors = $selectors | append $selector -}} {{- $rules = $rules | append (printf `%s { mask-image: url("data:image/svg+xml;base64,%s"); }` $selector ($svg.Content | base64Encode)) -}} {{- end }}