ThomasTJdev / nim_websitecreator

Nim fullstack website framework - deploy a website within minutes
https://nimwc.org
MIT License
177 stars 7 forks source link

Idea: Add optional minimal favicon.ico #21

Closed juancarlospaco closed 5 years ago

juancarlospaco commented 6 years ago

Most of Browsers request automatically the favicon.ico even if you use it or not (I dunno if thats standard compliant or not but still), most of times produces several failed HTTP GETs, what if we add the option to use the smallest possible syntactically valid ICO file (70 Bytes)

logs for 1 request from browser (it request it twice the first time):

DEBUG GET /favicon.ico
DEBUG   404 Not Found {"content-type": @["text/html;charset=utf-8"]}
DEBUG GET /favicon.ico
DEBUG   404 Not Found {"content-type": @["text/html;charset=utf-8"]}
DEBUG GET /favicon.ico
DEBUG   404 Not Found {"content-type": @["text/html;charset=utf-8"]}

Just adding a staticRead("favicon.ico") with this file will fix it.

it can be disabled if the user has a favicon.ico on the static folder or can be done with a parameter somewhere. AFAIK it can not be disabled, browsers still request it anyways, is like hardcoded on them. File is cached, so it will be requested once if it works.

Question: Should we try to report this idea to Jester instead ?.

:thinking:

ThomasTJdev commented 6 years ago

On what pages do you get the 404?

Standard ico

NimWC provides a favicon.ico located here: https://github.com/ThomasTJdev/nim_websitecreator/blob/master/public/images/logo/favicon.ico

Include icons

favicon.ico is not requested on my system in either Firefox and Chromium, so I don't see the 404. The core also uses favicon-16x16.png, favicon-32x32.png and favicon-192x192.png for the Admin pages (settings).

The user currently needs to handle this buy them self, except if the use the standard data, where the same code is standard in the <head>.

# main.tmpl - genMainAdmin()
  <link rel="shortcut icon" href="/images/logo/favicon.ico">
  <link rel="icon" type="image/png" href="/images/logo/favicon-16x16.png" sizes="16x16">
  <link rel="icon" type="image/png" href="/images/logo/favicon-32x32.png" sizes="32x32">
  <link rel="icon" type="image/png" href="/images/logo/favicon-192x192.png" sizes="192x192">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/logo/favicon-180x180.png">

Remove or ..

I would prefer to let the user handle it by them self. Currently they can remove the <link> tag from header or change it to a icon file they uploaded.

Otherwise we could provide some guidance with either the ico you linked to or

<link rel="icon" href="data:;base64,iVBORw0KGgo=">

Jester

I think Jester needs to stay as a webserver, where the user has to manage the surroundings.

juancarlospaco commented 6 years ago

I think this one is Fixed on last version :grey_question:

ThomasTJdev commented 5 years ago

Fixed in 4.0.5