Jump to content

How to setup a favicon for my PW website?


LAPS
 Share

Recommended Posts

@DaveP I tried to put the favicon.ico file in /, /site, /wire and others directories, as well as refresh both PW and browser cache, but it does not work. I also added the link code in the <head> tag of my template file, as follows:

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

Link to comment
Share on other sites

This code should help you get to the wire directory:

<link rel="icon" type="image/x-icon" href="<?php echo $config->urls->root ?>wire/favicon.ico">


But I prefer to add in the directory of my template files in which I change the path to (templates/):

<link rel="icon" type="image/x-icon" href="<?php echo $config->urls->templates ?>assets/img/favicon.ico">


Here you can read more about $config:
https://processwire.com/api/variables/config/

  • Like 1
Link to comment
Share on other sites

I usually go by @rafaoski's approach.

I first go to http://www.favicomatic.com/, upload a 500x500 image to generate a full icon pack.

Then I place the icons in their own folder inside the templates folder. Usually /site/templates/img/favicon/

Favicomatic gives you a rather large HTML snippet. Slap that on your template, and on each line that points to a file, you'll have to fix the url, like so:

<link rel="icon" type="image/x-icon" href="<?= $config->urls->templates ?>img/favicon/favicon.ico">

 

  • Like 8
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...