A user is trying to replace the bars icon for the sidebar toggle in Discourse using a custom SVG spritesheet but is not seeing the icon. After troubleshooting, it’s determined that the issue lies in the SVG code lacking a viewBox attribute. Penar Musaraj suggests adding the viewBox attribute, which resolves the problem. Lilly confirms that replacing the icon with a default one works, indicating the issue is with the custom SVG. Manuel also advises checking the icon code in the inspector and adjusting the icon ID if needed. The user successfully fixes the issue by ensuring the SVG includes the required viewBox attribute davidkingham.
did you try it with lowercase asset filename instead (eg: npn_spritesheet.svg)?
because otherwise that looks like it should work (i can easily do it with a v5 icon but i don’t have any v6 pro ones).
Strangely, when I delete that asset and reupload with a lowercase version (I even renamed it to npnassets.svg, I still see the old filename…
Since I downloaded the svg and inserted manually in the spritesheet I don’t think this should be an issue, that’s why I took this route since v5 doesn’t have a sidebar icon.
So the icon code from the spritesheet is not rendered. You could still try to change the id of the icon to a name without dash, like npnsidebar. sometimes i encounter issues with variable names in themes for which i can’t figure out the actual cause, but making a small adjustment fixes it.
Else you could share the svg file. I saw you pixelated the actual code, but it will be publicly accessible anyways when you use it on your live site (edit: ah, didn’t see it’s from the pro plan..)
Thanks, I tried changing the name to npnsidebar in the spritesheet and the code which allowed me to replace the spritesheet properly as well. But unfortunately it did not help. I can DM you the spritesheet and svg to double check my work. Thanks for your help!
If you replace the bars icon with another icon in the default set, does the replacement work? Say, replace it with cog or comment.
If that works, then the issue is with your custom SVG symbol code. It probably needs a viewBox attribute. Like this custom icon (for the gifs theme component):