Skip to content

onBrokenLinks throw errors when linking to an external static html page #9758

@jbltx

Description

@jbltx

Edit from @slorber: the bug/repro is about a static/my-route/index.html resource and navbar item linking to it with a target:

        {
          href: '/my-route',
          label: 'My Route',
          prependBaseUrlToHref: true,
          target: '_blank',
          position: 'left',
        },

Links with a target: "_blank" should not be checked because they are unlikely to be internal SPA links.

Description

After upgrading from 3.0.1 to 3.1.0, the onBrokenLinks feature throw exception on static routes while it was not the case before.

Reproducible demo

https://stackblitz.com/edit/github-fausgf

Here is a fork of the repro project but using 3.0.1 without errors: https://stackblitz.com/edit/github-fausgf-qpa5vb

Steps to reproduce

  • Create a new Docusaurus project
  • Create a simple index.html file inside a subfolder in static directory
  • In the Docusaurus config, add a NavBar item to link to this static html page
  • Try to do a production build using npm run build
  • Observe thrown errors during server compilation

Expected behavior

Does not throw errors for static page links (like in 3.0.1)

Actual behavior

Throw errors for static page links

Your environment

  • Public source code: None
  • Public site URL: None
  • Docusaurus version used:3.1.0
  • Environment name and version:Node 18.17
  • Operating system and version:MacOS 14.2.1 and Unbuntu 22.01

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