Question

I tried to replace favicon.ico in /web-app/images/ folder but it doesn't work : my site still has the usual Grails favicon. What do I need to do more?

Was it helpful?

Solution

try to change views\layout\main.gsp

<html>  
    <head>  
        <title><g:layoutTitle default="Grails" /></title>  
        <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'main.css')}" />  
        <link rel="shortcut icon" href="${createLinkTo(dir:'images',file:'favicon.ico')}" type="image/x-icon" />  
        <g:layoutHead />  
        <g:javascript library="application" />                  
    </head>  
    <body>  
        <div id="spinner" class="spinner" style="display:none;">  
            <img src="${createLinkTo(dir:'images',file:'spinner.gif')}" alt="Spinner" />  
        </div>      
        <div class="logo"><img src="${createLinkTo(dir:'images',file:'grails_logo.jpg')}" alt="Grails" /></div>     
        <g:layoutBody />        
    </body>     
</html>

and comment

<link rel="shortcut icon" href="${createLinkTo(dir:'images',file:'favicon.ico')}" type="image/x-icon" /> 

or clean your browser's cache. ;-)

OTHER TIPS

With the grails assets plugin you must use:

<head>
    ...
    <asset:link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
</head>

Put favicon.ico file to PROJECT/grails-app/assets/ folder,

add to UrlMappints

class UrlMappings {

    static mappings = {
      ......
      "/favicon.ico"  (uri: "/assets/favicon.ico")
    }
}

Place your icon file in this path:

grails-app\assets\images\favicon.ico

Then add this to the head element of your html:

<link rel="shortcut icon" href="/assets/favicon.ico">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top