LAPS Posted January 10, 2018 Posted January 10, 2018 I tried to do some search, but I did not find how to setup a favicon for my PW website e.g. where to put favicon file(s)?
kongondo Posted January 11, 2018 Posted January 11, 2018 See this (webroot or rel=icon methods) https://stackoverflow.com/questions/11893478/add-favicon-to-website
LAPS Posted January 11, 2018 Author Posted January 11, 2018 @kongondo I read the linked answer, but what is the webroot in PW? I mean, what is the directory (e.g. /site, /wire) where I have to put my favicon file(s)?
DaveP Posted January 11, 2018 Posted January 11, 2018 It's the folder that /site/ and /wire/ live in; the one where index.php and .htaccess are (in a standard install). 1
LAPS Posted January 11, 2018 Author Posted January 11, 2018 @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">
kongondo Posted January 11, 2018 Posted January 11, 2018 (edited) 1 hour ago, LAPS said: but what is the webroot in PW? What @DaveP said...For example: /var/www/html/site /var/www/html/wire /var/www/html/favicon.ico /var/www/html/.htaccess Edited January 11, 2018 by kongondo 1
rafaoski Posted January 11, 2018 Posted January 11, 2018 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/ 1
heldercervantes Posted January 12, 2018 Posted January 12, 2018 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"> 9
psy Posted January 12, 2018 Posted January 12, 2018 There are loads of favicon generators. I generally use https://www.favicon-generator.org/ then point the link href to the appropriate directory & file 3
LAPS Posted January 13, 2018 Author Posted January 13, 2018 OK, it works. Thank you for your replies. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now