diff options
author | pippo <roberto.jordaney.2014@live.rhul.ac.uk> | 2020-07-23 23:01:40 +0300 |
---|---|---|
committer | pippo <roberto.jordaney.2014@live.rhul.ac.uk> | 2020-07-23 23:01:40 +0300 |
commit | 87605af8e9ded0ade61d6979a3023eafca6ece46 (patch) | |
tree | c2f81f4ddea73283465d0270bd7249526a49cb00 | |
parent | a1cc3e6f72240a45722fb0aa417bfb4e52ba7579 (diff) |
Added icons on navbar
-rw-r--r-- | exampleSite/config.yaml | 8 | ||||
-rwxr-xr-x | layouts/partials/navbar-clone.html | 18 | ||||
-rwxr-xr-x | layouts/partials/navbar.html | 19 |
3 files changed, 39 insertions, 6 deletions
diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 935107e..fb8b685 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -81,9 +81,11 @@ params: # navbar options navbar: - # option to specify the logo of the sidebar + # option to specify the font used in the navbar fontFamily: "Open Sans" - + # option to show the little logos on the side of the navbar items + showIcons: false + # 404 page options pagNotFound: # option to specify the main picture of the sidebar @@ -100,7 +102,7 @@ params: homepage: # this options let you specify if you want a link to the homepage # it can be: "none", "menu", "footer" or "menu+footer" - linkPosition: "footer" + # linkPosition: "footer" # this options let you specify the text of the link to the homepage # linkText: "Homepage" # option to specify the title in the homepage diff --git a/layouts/partials/navbar-clone.html b/layouts/partials/navbar-clone.html index b6711a2..8144173 100755 --- a/layouts/partials/navbar-clone.html +++ b/layouts/partials/navbar-clone.html @@ -36,12 +36,19 @@ </div> - + {{- $showIcons := false -}} + {{- if .Site.Params.navbar.showIcons -}} + {{- $showIcons = .Site.Params.navbar.showIcons -}} + {{- end -}} + {{- $mainColour := .Site.Params.mainColour -}} <div id="cloned-navbar-menu" class="navbar-menu is-static"> <div class="navbar-end"> {{- $home := .Site.Params.homepage.linkPosition -}} {{- if or (eq $home "menu") (eq $home "menu+footer") -}} <a href="{{ "/" | relLangURL }}" class="navbar-item is-secondary"> + {{- if $showIcons -}} + <i class="fa fa-home" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- if .Site.Params.homepage.linkText -}} {{- print .Site.Params.homepage.linkText -}} {{- else -}} @@ -52,6 +59,9 @@ {{ range .Site.RegularPages }} {{- if eq .Params.showInMenu true -}} <a href="{{- .Permalink | relURL -}}" class="navbar-item is-secondary"> + {{- if $showIcons -}} + <i class="fa fa-file-text" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- .Title -}} </a> {{- end -}} @@ -62,6 +72,9 @@ {{- if (ne $secCount 0) -}} <div class="navbar-item has-dropdown is-hoverable"> <a href="{{- .Permalink | relURL -}}" class="navbar-link"> + {{- if $showIcons -}} + <i class="fa fa-book" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- .Title -}} </a> <div class="navbar-dropdown"> @@ -77,6 +90,9 @@ </div> {{- else -}} <a href="{{- .Permalink | relURL -}}" class="navbar-item is-secondary"> + {{- if $showIcons -}} + <i class="fa fa-book" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- .Title -}} </a> {{- end -}} diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 4f70c4f..7cb9f16 100755 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -35,8 +35,11 @@ </a> </div> - - + {{- $showIcons := false -}} + {{- if .Site.Params.navbar.showIcons -}} + {{- $showIcons = .Site.Params.navbar.showIcons -}} + {{- end -}} + {{- $mainColour := .Site.Params.mainColour -}} <div id="navbar-menu" class="navbar-menu is-static"> <!-- <div class="navbar-start"></div> --> <div class="navbar-end"> @@ -44,6 +47,9 @@ {{/* {{- if or (eq $home "menu") (eq $home "menu+footer") -}} */}} {{ if or (eq $home "menu") (eq $home "menu+footer") }} <a href="{{ "/" | relLangURL }}" class="navbar-item is-secondary"> + {{- if $showIcons -}} + <i class="fa fa-home" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- if .Site.Params.homepage.linkText -}} {{- print .Site.Params.homepage.linkText -}} {{- else -}} @@ -54,6 +60,9 @@ {{ range .Site.RegularPages }} {{- if eq .Params.showInMenu true -}} <a href="{{- .Permalink | relURL -}}" class="navbar-item is-secondary"> + {{- if $showIcons -}} + <i class="fa fa-file-text" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- .Title -}} </a> {{- end -}} @@ -64,6 +73,9 @@ {{- if (ne $secCount 0) }} <div class="navbar-item has-dropdown is-hoverable"> <a href="{{- .Permalink | relURL -}}" class="navbar-link"> + {{- if $showIcons -}} + <i class="fa fa-book" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- .Title -}} </a> <div class="navbar-dropdown"> @@ -79,6 +91,9 @@ </div> {{- else -}} <a href="{{- .Permalink | relURL -}}" class="navbar-item is-secondary"> + {{- if $showIcons -}} + <i class="fa fa-book" style="color:{{- print $mainColour -}};"> </i> + {{- end -}} {{- .Title -}} </a> {{- end -}} |