Skip to content

Locally served site's image links are broken when docsUrl is blank #1177

Description

@will-stone

🐛 Bug Report

When the docsUrl setting is configured to put all docs in the root, i.e. docsUrl="", images that are linked to in documents using ![example](assets/example.jpg) are broken. Whereas this works fine when built/published; images are linked to correctly.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Initialise a new Docusaurus project.
  2. Rename the example docs directory to docs.
  3. Yarn install the modules in the website directory.
  4. Delete the example blog directory.
  5. Remove the blog entry from headerLinks in website/siteConfig.js.
  6. Add docsUrl: "" setting to website/siteConfig.js.
  7. Add docs/assets directory and put an example image in there.
  8. Link to your example image in a doc document: ![example](assets/example.jpg).

Expected behavior

When running the website locally, the image should be shown.

Actual Behavior

Image link is broken when running website locally (yarn start).

Reproducible Demo

Repo:
https://github.com/will-stone/docusaurus-image-issue
Site Config:
https://github.com/will-stone/docusaurus-image-issue/blob/master/website/siteConfig.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions