Skip to content

Broken asset links when using cleanUrl setting #897

@eimerreis

Description

@eimerreis

🐛 Bug Report

When using the cleanUrl: true setting, docusaurus generates new sub folders for each site. For example, if you want clean url /docs/Connectivity, what docusaurus generates is a sub folder called Connectivity with an index.html file in it instead of the original Connectivity.html.

I really like the idea of this, but when the index.html within a cleanUrl subfolder references an image from the docs/assets folder, the link is broken because it's still relative to the original docs/ folder.

To Reproduce

  1. Set cleanUrl to true in siteConfig.js
  2. Reference an image from the assets folder within your markdown file
  3. Browse to the clean url, e.g. docs/Contributing, instead of docs/Contributing.html
  4. Image in clean URL is broken, in .html document image will work.

Expected behavior

When setting cleanUrl to true, docusaurus generates correct asset links to parent directory, where asset directory is located.

Actual Behavior

Image is broken due to link still being relative to parent directory instead of being relative to the directory created for clean url

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    better engineeringNot a bug or feature requestbugAn error in the Docusaurus core causing instability or issues with its executionclosed: wontfixA fix will bring significant overhead, or is out of scope (for feature requests)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions