function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jason BenkertJason Benkert 

Icons not displaying in Community

I have a Community built in Community Builder that uses lightning components and the Lightning Design System css & asset package.  I am using one of the svg icons from the SLDS assets, and it's working fine in the sandbox (the published community in the sandbox is rendering the icon as expected).

However, now that the community is in Production, the published pages are not displaying the icon, and I'm getting a 404 error when the page tries to load the asset: "https://myclientsorg.force.com/resource/SLDS0122/assets/icons/custom-sprite/svg/symbols.svg "  This is the path to the asset that's failing to load.  However, I'm using the CSS from the same package, so it's just the svg symbols that aren't showing up.

Can anyone provide any insight??
 
Balasubramaniam 07Balasubramaniam 07
Hi Jason,
Try adding community name in the URL mentioned in svg component.
For ex. /CommunityName/resource/SLDS/asset...
Amit VaidyaAmit Vaidya
Adding UrlPathPrefix works like a charm as said above by Balasubramaniam.

For getting UrlPathPrefix, you can use following query:

String urlpathprefix = [Select UrlPathPrefix from Network where Name ='Community_Name'].UrlPathPrefix;
system.debug(urlpathprefix);

Thanks,
Amit