From 702753e3580bc30e8c904eb072e98f46296202ed Mon Sep 17 00:00:00 2001 From: Olivier Roques Date: Wed, 25 Nov 2020 11:31:11 +0100 Subject: Add support for menu item pre and post hooks Closes #8 --- exampleSite/config.toml | 3 +++ layouts/partials/header.html | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a78b5d6..7dd0f4a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -25,6 +25,9 @@ googleAnalytics = "" # add your tracking id [[menu.main]] name = "Resume" url = "/resume.pdf" + # 'pre' and 'post' hooks are available + # here we use an icon from Bootstrap https://icons.getbootstrap.com/ + pre = ' ' weight = 2 [[menu.main]] name = "Contact" diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 7fcd975..aba1999 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -5,7 +5,9 @@ {{ with .Site.Menus.main }} {{ $navbar_len := len . }} {{ range $i, $nav_item := . }} - {{ $nav_item.Name }} + + {{ $nav_item.Pre }}{{ $nav_item.Name }}{{ $nav_item.Post }} + {{ if ne (add $i 1) $navbar_len }} / {{ end }} -- cgit v1.2.3