I can successfully find out what text is required to use Font Awesome icons in the front matter for my project just looking at the theme docsy’s source code. I would like to also not need to guess how to use other icon sets such as mdi.
This documentation does not describe the method that works, but does describe methods that do not work.
Example that works but only for Font Awesome icons:
---
title: Dashboard
linkTitle: Dashboard
icon: fa fa-gauge
type: docs
Example based on the documentation which definitely doesn’t work (shortcode in the front matter section). It would be nice if this worked though!
---
title: Welcome to omis docs
linkTitle: omis docs
icon:
"{ < icons/icon mdi inbox > }": null
How can we determine the secret words for mdi icon module usage in front matter? The documentation implies it is supported just like Font Awesome is supported but the method that works doesn’t appear where one would expect it to appear in the documentation, namely under “Usage”.
Just reviewing how this is implemented in that documentation site menu itself I see the advanced method has the unfortunate side effect of making the source code unreadable/learnable. Not as elegant a solution from my novice perspective. I’llassume it was done in service to load time improvement. In my case this “advanced” method currently is slowing me down.
{{ $res := dict "vendor" "font awesome" "name" "inbox-full" }}
2{{ with partialCached "icons/functions/svg-resource" $res $res }}
3 <img src="{{ .RelPermalink }}" />
4{{ end }}
Based on this support post it looks like I need to search the project for text containting “Params.Icon”. Which leads me to docs/themes/docsy/layouts/partials/sidebar-tree.html as well as /docs/themes/assets/vendor/boostrap/site/layouts/partials/docs-navbar.html.where we find the word Bootstrap.
Based on this other support post I need to duplicate some unknown partial from the docsy theme and put in the relevant information for mdi icons…
But when I look at the docsy repo, and search for “awesome”, I see quite a bit more than I expect if the use of another icon set is as direct and supported as the documentation for Hugo makes it out to be.
Viewing this post suggests something will work that might not otherwise work unless the modules are loaded in a special order. Not sure thats true but I put the module for mdi above the others just to see.
No change…
However mdi is appearing successfully outside of front matter using short codes and it automagically does it as an inline svg. I guess that is the point of the icon set being called an inline svg icon set.