facebook / facebook/docusaurus

Unability to link to an internal non-SPA link

Đang mở
#3,309 27 bình luận 7 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
TypeScript
Star
66.2k
Fork
10k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
52

Mô tả

## 🐛 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:

```
Javadoc
```

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.