Skip to content

Navbar logo and favicon images are not showing up while serving locally for sites with baseUrl #5863

@pranabdas

Description

@pranabdas

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

After updating to docusarus beta 9, the navbar logo image (and favicon image) is not showing up while serving the site locally. This happens with sites having baseUrl (other than /). If I visit http://localhost:3000/{baseUrl}/img/favicon.ico, I see 404 Page Not Found. However, things seems alright while building the site.

Steps to reproduce

  1. Create a brand new site: npx @docusaurus/init@latest init my-site classic
  2. Set a baseUrl in docusaurus.config.js, say /test/
  3. Fire up npm start. This is what I see:

Screenshot 2021-11-03 at 9 26 27 PM

  1. Visit http://localhost:3000/test/img/favicon.ico, it gives 404 error.
  2. However, npm run build followed by npm run serve correctly shows the logo.

Expected behavior

Should be able to see the logo and favicon images correctly while serving the site locally.

Actual behavior

Logo and favicon images are not available in website path.

Your environment

  • Public source code: NA
  • Public site URL: NA
  • Docusaurus version used: 2.0.0-beta.9
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Safari 15.1, Node.js 16.13.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS 11.6.1

Reproducible demo

No response

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions