Print this page

Images saved as Static Resources don't display on a Community page

Knowledge Article Number 000193729
Description
If you create a static resource that stores an image, you might want to use this image on a Community page. Let's assume the URL of your static resource is as follows

https://naX.salesforce.com/resource/13237000/PortalLogo

An example would be if you wanted this component to show as a home page component on your Community home page, so you would create an HTML component that looks like this

<img src="https://naX.salesforce.com/resource/13237000/PortalLogo">

When logging in as a Community user, you will notice that the image link is broken.
Resolution
The reason this happens is because your Community has a different domain than your salesforce instance. For example

Your instance: na12.salesforce.com

Your community: mycommunity.com/support

For these images to be available, the home page component needs to use the relative URL, including the name of your community page. For example

<img src="/support/resource/13237000/PortalLogo> - Replace "/support/" with the name of your community page. 

Another workaround, is to use upload the image to the Documents tab, and enable the "Externally Available Image" setting. Then, you can use the URL of this image on your home page component and it will be accessible to anyone, regardless of the domain. Note, you do not need to change the URL of the document, since it's stored in our server and is accessible to anyone. 

When used in a visualforce page, use the URLFOR function. 


 




promote demote