having issues setting up favicon.ico on my site

99 views
Skip to first unread message

Grey White

unread,
Sep 27, 2018, 2:18:43 PM9/27/18
to golang-nuts
Good day guys,
I need help with attaching favicon.ico to my site
that is my folder structure.
i really can't tel what am doing wrong

Capture.PNG

func main() {
   http.HandleFunc("/favicon", faviconHandler)
   log.Fatal(http.ListenAndServe(":8080", nil))
}

func faviconHandler(w http.ResponseWriter, r *http.Request) {
    http.ServeFile(w, r, "/crm-app/favicon.ico")
}

my links in index.html
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
   <link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
   <link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
   <link rel="manifest" href="/favicon/site.webmanifest">
   <link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
   <link rel="shortcut icon" href="/favicon/favicon.ico">
   <meta name="msapplication-TileColor" content="#ffffff">
   <meta name="msapplication-config" content="/favicon/browserconfig.xml">
   <meta name="theme-color" content="#ffffff">


Justin Israel

unread,
Sep 27, 2018, 3:39:39 PM9/27/18
to Grey White, golang-nuts


On Fri, Sep 28, 2018, 6:18 AM Grey White <sog...@gmail.com> wrote:
Good day guys,
I need help with attaching favicon.ico to my site
that is my folder structure.
i really can't tel what am doing wrong

Capture.PNG

func main() {
   http.HandleFunc("/favicon", faviconHandler)
   log.Fatal(http.ListenAndServe(":8080", nil))
}

func faviconHandler(w http.ResponseWriter, r *http.Request) {
    http.ServeFile(w, r, "/crm-app/favicon.ico")
}

Are your deployed assets actually stored in /cram-app? Otherwise maybe you want the path to be relative to where the binary is running:
    crm-app/favicon.ico


my links in index.html
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
   <link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
   <link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
   <link rel="manifest" href="/favicon/site.webmanifest">
   <link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#5bbad5">
   <link rel="shortcut icon" href="/favicon/favicon.ico">
   <meta name="msapplication-TileColor" content="#ffffff">
   <meta name="msapplication-config" content="/favicon/browserconfig.xml">
   <meta name="theme-color" content="#ffffff">


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tamás Gulácsi

unread,
Sep 27, 2018, 3:44:23 PM9/27/18
to golang-nuts
/favicon and /favicon/ is not the same!
Reply all
Reply to author
Forward
0 new messages