feat(blog): implement loading and error handling components for blog pages feat(clinic): add loading and error handling components for clinic pages feat(doctor): create loading and error handling components for doctor pages feat(clinics): add loading component for clinics page feat(specialties): improve metadata for specialties page with Open Graph and Twitter images feat(layout): add structured data for Organization and WebSite in layout fix(middleware): restrict middleware execution to specific routes to improve performance chore(audit): add comprehensive SEO and performance audit documentation
24 lines
805 B
JavaScript
24 lines
805 B
JavaScript
import { NextResponse } from 'next/server';
|
|
|
|
export function middleware(request) {
|
|
const response = NextResponse.next();
|
|
|
|
// Add pathname to headers so we can access it in getCanonicalUrl
|
|
response.headers.set('x-pathname', request.nextUrl.pathname);
|
|
|
|
return response;
|
|
}
|
|
|
|
export const config = {
|
|
matcher: [
|
|
/*
|
|
* Match all request paths except for the ones starting with:
|
|
* - api (API routes)
|
|
* - _next/static (static files)
|
|
* - _next/image (image optimization files)
|
|
* - favicon.ico (favicon file)
|
|
* - panel, dashboard, login, login-verify (auth-gated/noindex pages — canonical URL has no SEO value here)
|
|
*/
|
|
'/((?!api|_next/static|_next/image|favicon.ico|panel|dashboard|login|login-verify).*)',
|
|
],
|
|
}; |