microsoft / microsoft/pxt-microbit
External links are broken when docs are accessed via a versioned link
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 804
- Forks
- 721
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 2
Description
Describe the bug
External links are broken when docs pages are accessed via a versioned link to the docs.
E.g. on https://makecode.microbit.org/v9/coding-cards all external links are broken but on https://makecode.microbit.org/coding-cards they work.
The actual hrefs are nonsense on the versioned one, e.g. /v9https://drive.google.com/open?id=1Tl80unLA5_Zwkymh1flSbwuZbCIqSOxQ. The version part has been inappropriately prepended to an absolute URL.
This came up on a support request noting the links were broken (using a v2 link, unclear source, we will try to confirm).
Not a big deal as I think these links should be uncommon, but potentially a quick fix to not resolve external/absolute links at all, or use a resolution approach that skips absolute URLs (like the URL constructor).
Expected behavior
External links work as normal regardless of how the page is accessed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with /v9/coding-cards and the unversioned /coding-cards URL, then locate the docs-link URL resolution entry point. Check how absolute external URLs such as the Google Drive example are handled. Done means external hrefs remain unchanged and work from both versioned and unversioned pages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100