Favicon?

Travis

Active member
How do we install a Favicon? Does it have to go in a certain folder,because I put it in the Forum Root,but no luck.
 
Browsers love to cache those images, so you might not see the new image in your browser if you have already bookmarked it.

Also, I often have to add a reference to the page head:

Admin CP -> Appearance -> Templates -> PAGE_CONTAINER

Rich (BB code):
<!DOCTYPE html>
<html id="XenForo" class="Public {xen:if {$visitor.user_id}, 'LoggedIn', 'LoggedOut'}">
<head>
    <meta charset="utf-8" />
    <xen:if is="{$requestPaths.fullBasePath}"><base href="{$requestPaths.fullBasePath}" /></xen:if>
 
    <title><xen:if is="{$title}">{xen:raw $title} | {$xenOptions.boardTitle}<xen:else />{$xenOptions.boardTitle}</xen:if></title>
 
    <link rel="stylesheet" type="text/css" href="css.php?css=xenforo,form,public&amp;style={xen:urlencode $_styleId}&amp;d={$visitorStyle.last_modified_date}" />
    <!--XenForo_Require:CSS-->

    <xen:include template="google_analytics" />
    <xen:include template="page_container_js_head" />
 
    <xen:if is="{$pageDescription.content} AND !{$pageDescription.skipmeta} AND !{$head.description}"><meta name="description" content="{xen:string wordTrim, {xen:helper stripHtml, {xen:raw $pageDescription.content}}, 200}" /></xen:if>
    <xen:if is="{$head}"><xen:foreach loop="$head" value="$headElement">{xen:raw $headElement}</xen:foreach></xen:if>
    <LINK REL="SHORTCUT ICON" HREF="http://xenforo.com/favicon.ico">
</head>
<body>

Change the HREF appropriately.

This is a serious bump, but I suppose it's better than starting a new thread?

Do I just add this code below everything, with the exsisting code still intact? This would create a second set of head and body tags...

I've added the favicon to my root over 24 hours ago and it's still not displaying. http://forgehaven.com/forums/
 
Hey it's there now! I didn't do anything to PAGE_CONTAINER yet, haha. It's so weird because I cleared my cookies/cache earlier and it still wasn't updated, just did it again and there it is. Cool stuff, thanks!
 
Adding a link element to the following template is still working just fine on my 1.5.12 install.
Admin CP -> Appearance -> Templates -> PAGE_CONTAINER

To make sure it gets updated on the client machines whenever it needs to, you ought to change the version number after updating your icon as explain on StackOverflow.
I ended up adding the following line in my html header:
HTML:
<link rel="icon" href="/favicon.ico?v=2" />
 
Last edited:
@Jake Bunce, is it possible to have non-hard-coded URL for favicon.ico?

How to call XenForo URL with helper? {xen:helper fullurl,??
Can't you use href="{$xenOptions.boardUrl}/favicon.ico" or href="{xen:link favicon.ico}" maybe ?

Also, the page_container has a hook, a listener event could inject it. So this makes upgrading easier and applies to all styles on the board.

And for refreshing caching, the style css has this: d={$visitorStyle.last_modified_date}"

Can't we use that for favicon.ico?v={$visitorStyle.last_modified_date} maybe ?
 
And since I wanted to do this for my own site for the benefits a plugin gives, I've posted it on my site here for download
Great stuff, though it seems like the ?v= approach you have is not that reliable right? You could still update the ICO without changing the version and you could still change the version without the ICO having been updated. Would it not be easier for Admin to be able to specify the version in a text field on that add-on config page?
From there it is probably quite easy to add header colour functionality to that add-on.
One could even make a generic add-on to inject a provided HTML text in the HTML header, end of story.
 
Great stuff, though it seems like the ?v= approach you have is not that reliable right? You could still update the ICO without changing the version and you could still change the version without the ICO having been updated. Would it not be easier for Admin to be able to specify the version in a text field on that add-on config page?
From there it is probably quite easy to add header colour functionality to that add-on.
One could even make a generic add-on to inject a provided HTML text in the HTML header, end of story.
Fair point, I've added a field for a positive integer. If it's not 1, it will be used instead.
 
Top Bottom