- Implemented canonical URL strategies for city-specific domains and entities. - Added helper functions for domain and city resolution. - Created tests for canonical URL generation and domain resolution. - Introduced entity quality checks for doctors and clinics to ensure meaningful content. - Developed unique introductory texts for listing pages to avoid duplicate content. - Established robots.txt policies for listing pages to manage indexing based on user filters. - Enhanced specialty content with dynamic introductions and FAQs to improve SEO.
26 lines
999 B
JavaScript
26 lines
999 B
JavaScript
import { NextResponse } from 'next/server';
|
|
|
|
export function proxy(request) {
|
|
const response = NextResponse.next();
|
|
|
|
// Add pathname to headers so we can access it in getCanonicalUrl
|
|
response.headers.set('x-pathname', request.nextUrl.pathname);
|
|
// canonical صفحات لیست به pagination وابسته است، ولی layout به searchParams دسترسی ندارد
|
|
response.headers.set('x-search', request.nextUrl.search || '');
|
|
|
|
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).*)',
|
|
],
|
|
}; |