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

Handle URL extension routes with redirects #1005

Merged
merged 5 commits into from
Jan 14, 2025
Merged

Handle URL extension routes with redirects #1005

merged 5 commits into from
Jan 14, 2025

Conversation

@eyeseast eyeseast requested a review from allanlasser January 14, 2025 18:02
Copy link

netlify bot commented Jan 14, 2025

Deploy Preview for documentcloud-frontend-next ready!

Name Link
🔨 Latest commit 77aaeac
🔍 Latest deploy log https://app.netlify.com/sites/documentcloud-frontend-next/deploys/6786afb4aec4fd0008428287
😎 Deploy Preview https://deploy-preview-1005.muckcloud.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 19 (🔴 down 26 from production)
Accessibility: 87 (🟢 up 1 from production)
Best Practices: 83 (🔴 down 9 from production)
SEO: 83 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

Copy link

github-actions bot commented Jan 14, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 31.84% 7674 / 24099
🔵 Statements 31.84% 7674 / 24099
🔵 Functions 47.67% 339 / 711
🔵 Branches 75.66% 1113 / 1471
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/routes/(app)/documents/[id]-[slug]/+page.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/[id]-[slug].[format]/+page.ts 0% 0% 0% 0% 1
src/routes/(app)/projects/[id]/+page.ts 0% 0% 0% 0% 1
Generated in workflow #567 for commit 77aaeac by the Vitest Coverage Report Action

url = documents.pdfUrl(document);
return redirect(302, url);

// fallback: redirect to the canonical path, on the same host
Copy link
Member

Choose a reason for hiding this comment

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

This is a great approach! My only design question is whether .txt should redirect to the text mode in an embed viewer instead of the full-site viewer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Historically, there wasn't a difference between embed and normal versions of the viewer (except in the very beginning), but the .html extension is baked into the WordPress plugin (by me, a long time ago, sorry) so it's still used in embeds.

This is the old documentation: https://web.archive.org/web/20180301171441/https://www.documentcloud.org/help/publishing#linking

All that said, I don't have much evidence of anyone using the .txt. or .pdf links, and it hasn't been supported in a few years, so I think we're ok like this, and we can adjust if needed.

@eyeseast eyeseast merged commit b939621 into main Jan 14, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Embeds using .html endpoint are getting app view
2 participants