Web-item icon not showing

Hello,

Below is my atlassian-plugin.xml and the location of the icon.

But the icon is not displayed in the insert menu. Icon is missing for Marvel.

I tried “images/marvel-icon.png” and “/download/resources/${project.groupId}.${project.artifactId}/images/marvel-icon.png” but both didn’t work.

Any idea why it’s not displaying the icon?

Many thanks,
Joel

Hi Joel,

First I think you have to make sure the icon is declared as a web resource in atlassian-plugin.xml e.g:

 <resource name="marvel-icon.png" type="download" location="images/marvel-icon">
<param name="content-type" value="image/png"/>
</resource>

Then you can check that the icon is displayed at:

http://hostname:port/context/download/resources/${project.groupId}.${project.artifactId}/marvel.png

Then you can link to the icon at:

<link>/download/resources/${project.groupId}.${project.artifactId}/marvel.png</link>

Thanks Richard. I tried your suggestion. I added the resource tag and I can check the icon is accessible using the URL but is still does not appear beside the “Marvel” text.

I looked a bit more, and I think the information in my last post is quite out of date.

There is one other option documented here: https://developer.atlassian.com/server/confluence/adding-an-option-to-the-editor-insert-menu/

Basically, you create a css resource which loads the icon into the correct place:
(in this example css is located in ‘src/main/resources/css/editor.css’)

#insert-menu macro-marvel .icon {
   background: transparent url("mavel.png") 0 0 no-repeat;
   margin-top: 0px;
}

you will also have to change the web item link to:
<link linkId="marvel"/>

and add the css file to your web resource in the editor context e.g

<web-resource key="editorWebResource" name="Editor Web Resource">      
      <context>editor</context>
      <resource type="download" name="editor.css" location="${project.artifactId}/css/editor.css"/>
      <!-- add any other web resources for the editor here -->
</web-resource>

I know its a lot for a little icon! but apparently that is the way to do it.

P.s here it is working for me
Screenshot%20from%202019-11-05%2022-59-50|271x193

Much obliged @richard.white. The icon is displayed now. Had to resize it to 16x16 px.