Skip to content

fix(link): should support public folder asset#2440

Merged
SoonIter merged 7 commits intomainfrom
syt/should-link-to-public-folder
Aug 4, 2025
Merged

fix(link): should support public folder asset#2440
SoonIter merged 7 commits intomainfrom
syt/should-link-to-public-folder

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Aug 4, 2025

Summary

fix: should support public folder asset

Related Issue

close #2427

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings August 4, 2025 10:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes support for public folder assets by updating the Link component to handle external URLs that don't match any routes. The fix ensures that when a link points to a public asset or external URL that doesn't have a matching route, it navigates using window.location.href instead of attempting route-based navigation.

  • Adds fallback navigation for unmatched routes to support public folder assets
  • Prevents route navigation attempts for external URLs and static assets

Comment thread packages/theme-default/src/components/Link/index.tsx Outdated
Comment thread packages/theme-default/src/components/Link/index.tsx
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 4, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 1583e3c
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/6890a34bbc280400082e9766
😎 Deploy Preview https://deploy-preview-2440--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 4, 2025

Deploy Preview for rspress ready!

Name Link
🔨 Latest commit 1583e3c
🔍 Latest deploy log https://app.netlify.com/projects/rspress/deploys/6890a34bc768d1000808c6ec
😎 Deploy Preview https://deploy-preview-2440--rspress.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 79 (🟢 up 2 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (🟢 up 9 from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@SoonIter SoonIter changed the title fix: should support public folder asset fix(link): should support public folder asset Aug 4, 2025
@SoonIter SoonIter requested a review from Timeless0911 August 4, 2025 11:43
@SoonIter SoonIter merged commit bdd26fc into main Aug 4, 2025
11 checks passed
@SoonIter SoonIter deleted the syt/should-link-to-public-folder branch August 4, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Links do not support assets in public dir

3 participants