question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unability to link to an internal non-SPA link

See original GitHub issue

🐛 Bug Report

Related to https://github.com/facebook/docusaurus/issues/3303#issuecomment-676541070

Imagine you have /static/javadoc/index.html

You should be able to link to this page that is not managed by Docusaurus, using:

<Link to="/javadoc">Javadoc</Link>

or

[javadoc](/javadoc)

Yet, the link uses history.push() as it thinks it’s an SPA internal link, and we end up with the 404 as no SPA route is found.

It works after a refresh though, or if we use an URL with the http/https protocol.


Not sure how to solve this problem,

Maybe we should read the routes file directly on link, and when we press, only use history.push() if the link is a known internal SPA link, else fallback to a regular non-SPA navigation?

I don’t think there is a std way to provide additional link infos in Markdown, nor if MDX supports that. Another option would be to use a special protocol so that we force the link to consider it as a non-SPA link:

[javadoc](external:///javadoc)

Another solution would be to provide a remark plugin so that user can tell which URLs are to be considered as external. It may be overwhelming for a site user to write a remark plugin, so we could just ship a default one in MDX loader, that would read a list of paths to consider external in site config? Inspiration => https://github.com/remarkjs/remark-external-links

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:25

github_iconTop GitHub Comments

2reactions
slorbercommented, Sep 11, 2020

great @colriot 😃

the Sass fix is not published to npm yet, so you can use this workaround in the meantime: https://github.com/rlamana/docusaurus-plugin-sass/pull/5#issuecomment-685099274

1reaction
jhackett1commented, Feb 18, 2021

it would be great to add the pathname:/// trick to the docs. i just needed to do this for the sidebar and needed to go hunting for this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Most Common Internal Link Building Mistakes
The first and most obvious crawlability issue occurring with the links is that they don't work; this can happen because of a malformed...
Read more >
SpaLink RS®
Position the SpaLink RS, secured in the snap-on frame, within the mud box and temporarily tape the SpaLink RS control into the correct...
Read more >
Invariant failed: You should not use <Route> outside a ...
I got this during testing my component which linked to the project (using npm link ) and because of that react-router-dom loaded more...
Read more >
Links - Usability & Web Accessibility - Yale University
In that case, a screen reader may only read the link text and not the surrounding text. Speech recognition software allows a user...
Read more >
Troubleshoot Switch Port and Interface Problems
This means it is currently not connected to anything, but it can connect if it has a good connection to another operational device....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found