ericalli / static-site-boilerplate

A better workflow for building modern static websites.
http://staticsiteboilerplate.com
MIT License
1.73k stars 165 forks source link

Building site has wrong URLs for Favicons #11

Closed ethanbeyer closed 5 years ago

ethanbeyer commented 5 years ago

Describe the bug When I run npm run build:dist, all the favicons URLs inserted into the head of the HTML are prefixed with a /.

The static site I'm creating is in a directory: example.com/landing, so the favicons 404 when it looks for the images at example.com/images/favicons/*, when they are located at example.com/landing/images/favicons/*.

To Reproduce Steps to reproduce the behavior:

  1. Generate a dist folder with npm run build:dist
  2. Upload to a directory for a live site
  3. Visit the URL for the generated file: example.com/landing
  4. All the favicons 404.

Expected behavior I would expect that the URLs for favicons would be generated as images/favicons/*.

Desktop (please complete the following information):

Additional context When I ran npm run setup, I made sure that the URL for the live site included the directory - so either I edit the favicon: path.join(ROOT, '/src/images/favicon.png') in site.config.js (seems like a bad idea), or the system needs to generate the favicon URLs without a leading slash.

armno commented 5 years ago

@ethanbeyer this seems to be the issue on webapp-webpack-plugin https://github.com/brunocodutra/webapp-webpack-plugin/issues/106

my workaround is setting output.publicPath to an empty string '' in config/webpack.config.js

ethanbeyer commented 5 years ago

Ah, thank you!! I will test this, but it sounds like it could be the fix. Appreciate it!

ethanbeyer commented 5 years ago

This worked.