Ad

Adding A Favicon Via The Backend In October CMS

I want to create an file upload option for a favicon using the Theme Customization options: https://octobercms.com/docs/themes/development#customization

However, if I understand correctly, favcicons (and Apple Touch Icons) need to a) have a particular name and b) be located on the root directly (i.e., www.website.com/favicon.ico).

Is it possible to use the theme customization fileupload field and have the files uploaded to the root directory and given the names required to function as favicons and apple touch icons?

If so, any idea how?

Thanks.

Ad

Answer

For both favicon and Apple Touch icon you can declare a href attribute

<link rel="icon" type="image/png" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="http://example.com/myicon.png">

<link rel="apple-touch-icon" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="152x152" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="180x180" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="167x167" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="touch-icon-ipad-retina.png">

We may, alternatively, install this this free plugin: SEO Extension

Ad
source: stackoverflow.com
Ad