1

I created an app using express to host multiple signup pages. I would like each signup page to have it's own favicon; however, express seems to require a favicon in the configuration otherwise it uses it's default. My html favicon tags don't override the one cached by express.

user3245597
  • 153
  • 1
  • 6
  • See if [this Q&A](http://stackoverflow.com/questions/2208933/how-do-i-force-a-favicon-refresh?rq=1) is helpful. I am not sure you'd be successful doing this server-side alone, given how browsers seem to handle favicon caching. – barry-johnson Mar 10 '14 at 01:27

1 Answers1

1

You can't use the favicon middleware, because it assumes you have 1 favicon for the whole site (like you're supposed to.)

That said, you can force the favicon to be different things on each page.

Sign Up:

<link rel="shortcut icon" href="/public/favicon-signup.ico">

Sign In:

<link rel="shortcut icon" href="/public/favicon-signin.ico">

In your templating, for example jade, you'll want to leave a block favicon to be able to use a layout and still have the link in the head of the page.

Use static middleware to serve the favicons out of the public folder.

AJcodez
  • 31,780
  • 20
  • 84
  • 118
  • If I don't use the favicon middleware the default express favicon is shown even if I added the favicon tags in my html. How would I use static middleware to remove this default behavior? – user3245597 Mar 10 '14 at 22:08