Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put favicon to take JSF resource versioning into account?

Tags:

favicon

jsf-2

In my JSF webApp I have put all of my resources (js, css, img) into a versioned library as pointed out by BalusC in this answer.

Now my favicon also resided here:

resources --> default --> 1_1 --> img --> favicon.ico

According to this answer the way to add the favicon would be:

<link rel="shortcut icon" 
    type="image/x-icon" href="#{request.contextPath}/resources/default/1_1/img/favicon.ico"/>

But this way the resource handling that automatically picks files from the highest version folder (e.g. 1_1) is ignored and I would have to change this manually every time.

So is there another way to include the favicon or should the favicon be placed elsewhere (out of the versioned library)?

like image 784
Jens Avatar asked Jun 04 '13 13:06

Jens


1 Answers

Use implicit EL #{resource} handler to let JSF convert a resource identifier to proper URL.

<link ... href="#{resource['default:img/favicon.ico']}" />

Note that this is also the way you're supposed to use to reference background images in CSS files.

like image 89
BalusC Avatar answered Oct 07 '22 03:10

BalusC