diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index a285296..d5cf58d 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -174,10 +174,10 @@ menu: name: Home url: / weight: -100 - pre: home params: ### For demonstration purpose, the home link will be open in a new tab newTab: true + icon: home related: includeNewer: true diff --git a/exampleSite/content/page/about.md b/exampleSite/content/page/about.md index 79898de..494cb46 100644 --- a/exampleSite/content/page/about.md +++ b/exampleSite/content/page/about.md @@ -11,7 +11,8 @@ lastmod: '2020-10-09' menu: main: weight: -90 - pre: user + params: + icon: user --- Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows. diff --git a/exampleSite/content/page/archives.md b/exampleSite/content/page/archives.md index 027dfc6..2862deb 100644 --- a/exampleSite/content/page/archives.md +++ b/exampleSite/content/page/archives.md @@ -6,5 +6,6 @@ slug: "archives" menu: main: weight: -70 - pre: archives + params: + icon: archives --- diff --git a/exampleSite/content/page/search.md b/exampleSite/content/page/search.md index f54cdb5..b2a5943 100644 --- a/exampleSite/content/page/search.md +++ b/exampleSite/content/page/search.md @@ -8,5 +8,6 @@ outputs: menu: main: weight: -60 - pre: search + params: + icon: search --- \ No newline at end of file diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html index 53a6655..9d4dd3e 100644 --- a/layouts/partials/sidebar/left.html +++ b/layouts/partials/sidebar/left.html @@ -40,8 +40,12 @@
  • + {{ $icon := default .Pre .Params.Icon }} {{ if .Pre }} - {{ partial "helper/icon" .Pre }} + {{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://docs.stack.jimmycai.com/configuration/custom-menu.html" .URL }} + {{ end }} + {{ with $icon }} + {{ partial "helper/icon" . }} {{ end }} {{- .Name -}}