Three options:
- Do nothing - if favicon is called favicon.ico and sits in your public directory, most browsers will pick it up.
- The hardcode of the
<link> in your layout - Programmatically add a link tag, as in your code example
Personally, I would go for option 2. There is little point in programmatically adding an icon if it is always there. This may make sense if the icon was different for different users, for example. let's say your application has a theme system with different icons for different themes, then you can use headLink ().
Browsers typically cache badges for a long time, so as long as the link tag appears in your HTML source, it will eventually be updated. You can speed up the process by changing the file name, viewing the icon in your browser and / or clearing the browser cache.
source share