Struggling to understand docs on how to use this module
loganmarchione opened this issue · comments
Hi,
I'd like to use Simple Icons in my site, but I'm not understanding Hugo modules. Below is my config.yaml
file.
module:
hugoVersion:
extended: true
imports:
- path: github.com/adityatelange/hugo-PaperMod
- path: github.com/foo-dogsquared/hugo-mod-simple-icons
I then run these commands:
hugo mod init github.com/loganmarchione/loganmarchione.com
hugo mod get
hugo server
I can serve the site, and my theme works, but I'm not seeing anything in my assets folder. I was expecting to see some SVG files inside assets/svg/simple-icons
. Is this not correct?
% tree assets
assets
└── css
└── extended
└── pre.css
You shouldn't see any additional files in your assets folder. Any files imported through Hugo Modules are not visible in the filesystem. Instead, they are managed by Hugo through a virtual filesystem. So if you have the following code...
{{ $icon := resources.Get "svg/simple-icons/github.svg" }
{{ $icon.Permalink }}
...Hugo will search through the virtual filesystem to get that asset which is available from github.com/foo-dogsquared/hugo-mod-simple-icons
.
If you build the Hugo site with the above code snippet, you should now see that one of the icons from my Hugo module through the publishDir
, verifying that it works (see Assets publishing from Hugo docs).
Hope that clears up how Hugo modules work. Let me if you have more questions about Hugo modules.
Ah ok, I wasn't aware of that. I've got it working now, thank you!