Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(v2): redirect from should work with trailingSlash: true #5093

Merged

Conversation

slorber
Copy link
Collaborator

@slorber slorber commented Jun 30, 2021

Motivation

Follow-up of #5055 (comment)

When using trailingSlash: true, the redirect plugin does not emit files for fromExtensions: ['html'] because it ignorers all paths ending with /

If there's a path such as /xyz/, we should emit /xyz.html/index.html, otherwise deployments like Netlify wouldn't redirect when browsing /xyz.html, they would just serve the HTML file and it would lead to a 404 error due to the route not existing on the frontend router.

Also cleanup now useless warning since we reverted to emit /xyz.html/index.html, as the warning does not make sense anymore

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

test + preview

This URL now works fine, while it used to display a frontend 404 error: https://deploy-preview-5093--docusaurus-2.netlify.app/docs/typescript-support.html

Related PRs

#5085

@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Jun 30, 2021
@slorber slorber requested a review from lex111 as a code owner June 30, 2021 08:34
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jun 30, 2021
@netlify
Copy link

netlify bot commented Jun 30, 2021

✔️ [V2]

🔨 Explore the source changes: 852e179

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/60dc2cb24e073f000876bfed

😎 Browse the preview: https://deploy-preview-5093--docusaurus-2.netlify.app

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 85
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5093--docusaurus-2.netlify.app/

@github-actions
Copy link

Size Change: 0 B

Total Size: 601 kB

ℹ️ View Unchanged
Filename Size
website/build/assets/css/styles.********.css 87.7 kB
website/build/assets/js/main.********.js 415 kB
website/build/blog/2017/12/14/introducing-docusaurus/index.html 66.5 kB
website/build/docs/introduction/index.html 235 B
website/build/index.html 31.3 kB

compressed-size-action

@slorber slorber merged commit e5916dc into master Jun 30, 2021
@slorber slorber deleted the slorber/redirect-from-should-work-with-trailing-slash branch August 17, 2021 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants