Favicon and SVG #9
Replies: 8 comments 4 replies
-
the SVG isn't resizable, will mentioned in the docs. |
Beta Was this translation helpful? Give feedback.
-
Mentioned this on docs and output a warning message instead of an error. Thanks for your feedback. |
Beta Was this translation helpful? Give feedback.
-
I can't test until Monday, but if I am reading it right, if the code is supplied an SVG, not only will it not resize (good), but it will also not create the ! (bad) Shouldn't the if-then-else end before creating the element? Or at least, if SVG, create a single without resizing... |
Beta Was this translation helpful? Give feedback.
-
That is a shame. SVG is a valid favicon format, and superior in many respects BECAUSE it does not need to be resized. |
Beta Was this translation helpful? Give feedback.
-
Most except safari... Standard practice is to have 2 link icons defined. First is SVG, second is a fallback (PNG or whatever) https://caniuse.com/link-icon-svg Module should maybe accept two as well? |
Beta Was this translation helpful? Give feedback.
-
It seems that raster is required (e.g. PNG), such as I could add a parameter for SVG, such as WDYT? |
Beta Was this translation helpful? Give feedback.
-
Actually, I would never "remove" the raster icons, just that SVG is a preferred "source". The TL;DR section of https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7 gives an example pretty good "all-bases-covered" favicon block that includes SVG with multiple sizes of raster plus the fallback to favicon.ico. But that is a challenge for another day... |
Beta Was this translation helpful? Give feedback.
-
Implemented by hugomods/seo#15, I hope I'm doing it in the right way. Configuration example: params:
seo:
favicons:
icon: images/logo.png
svg_icon: images/logo.svg
mask_icon: images/logo.svg
mask_icon_color: '#6610f2'
sizes:
- size: 180x180
rel: apple-touch-icon |
Beta Was this translation helpful? Give feedback.
-
I am not skilled enough with these modules to track down the real source... feel free to re-direct.
I am re-creating an existing HUGO site to the new template structure.
When I add my favicon.svg to the "assets/images" folder, and update the seo section in params.yaml to match, it spits out a lengthy error message, complaining that
"... execute Resize: this method is only available for raster images. To determine if an image is SVG, you can do {{ if eq .MediaType.SubType "svg" }}{{ end }}"
Looking at the module reference (https://hugomods.com/en/docs/seo/#favicons-module) I now see you start with a PNG. A refinement of the favicon module would be to start with ANY source, and create the others, even with SVG...
My workaround was just to manually export to PNG and move on...
Beta Was this translation helpful? Give feedback.
All reactions