Skip to content

Remove ai-agents middleware rewrite #52

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

Merged
merged 4 commits into from
Apr 25, 2025
Merged

Conversation

ben-fornefeld
Copy link
Member

@ben-fornefeld ben-fornefeld commented Apr 24, 2025

This pr removes references to our framer landing page by removing LANDING_PAGE_FRAMER_DOMAIN from global/rewrite config and sitemap generation.

Additionally:

  • it adds a seo config for marking path globs as deprecated routes to inform seo crawlers about deprecation to get them removed from indexing faster by returning 410 (no content) status codes instead of 404 in catch-all route handler
  • configures /ai-agents/** paths to return 410

Copy link

vercel bot commented Apr 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 25, 2025 1:03pm
web-juliett ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 25, 2025 1:03pm

@ben-fornefeld ben-fornefeld self-assigned this Apr 24, 2025
@ben-fornefeld ben-fornefeld added improvement Improvements in-code rewrites and removed improvement Improvements in-code labels Apr 24, 2025
@ben-fornefeld ben-fornefeld marked this pull request as draft April 24, 2025 18:37
@ben-fornefeld
Copy link
Member Author

@mishushakov the way you suggested makes it slightly annoying to configure. remember when using js native regexp, for every literal / match you have to prefix with a \. since we try to match paths here, that can get quite cumbersome.

@ben-fornefeld
Copy link
Member Author

refactored to glob pattern matching for easier configurability

Comment on lines +1 to +14
/**
* Configuration for SEO-related settings.
*/

/**
* An array of glob patterns for deprecated routes that will return a 410 (Gone) status.
*
* Pattern syntax examples:
* - '/ai-agents' - Exact match for /ai-agents
* - '/ai-agents/*' - Matches a single segment (e.g., /ai-agents/foo)
* - '/ai-agents/**' - Matches multiple segments (e.g., /ai-agents/foo/bar)
* - '/ai-agents/{foo,bar}' - Matches /ai-agents/foo or /ai-agents/bar
* - '/ai-agents/!(foo|bar)' - Matches anything except /ai-agents/foo or /ai-agents/bar
*/
Copy link
Member

Choose a reason for hiding this comment

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

remove comments, I think the code is self-explanatory

Copy link
Member Author

Choose a reason for hiding this comment

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

it's not. if i just want to configure new paths and don't know anything about the repo this is helpful

Comment on lines +14 to +17
const normalizedPath =
pathname.endsWith('/') && pathname !== '/'
? pathname.slice(0, -1) // Remove trailing slash except for root path
: pathname
Copy link
Member

Choose a reason for hiding this comment

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

do you actually need to normalize it?

Copy link
Member

@mishushakov mishushakov left a comment

Choose a reason for hiding this comment

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

Small nits, but otherwise good to go

@ben-fornefeld ben-fornefeld merged commit a205c17 into main Apr 25, 2025
4 checks passed
@ben-fornefeld ben-fornefeld deleted the remove-ai-agents-rewrite branch April 25, 2025 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants