Add SEO data generation and testing for bilingual pages

- Implemented SEO data structures for programmatic tool and collection pages.
- Created functions to build FAQs and content sections for SEO pages.
- Added tests to ensure at least 50 bilingual SEO pages are generated, no duplicate English slugs, and matching Arabic localized paths.
- Verified that both tool and collection SEO inventories are populated adequately.
This commit is contained in:
Your Name
2026-03-21 10:55:43 +02:00
parent a8a7ec55a2
commit c800f707e3
12 changed files with 1920 additions and 22 deletions

View File

@@ -1,4 +1,8 @@
import seoToolsConfig from '@/config/seo-tools.json';
import {
PROGRAMMATIC_TOOL_PAGES,
SEO_COLLECTION_PAGES,
getLocalizedSeoLandingPaths,
} from '@/seo/seoData';
export type SeoLocale = 'en' | 'ar';
@@ -17,6 +21,11 @@ export interface SeoFaqTemplate {
answer: LocalizedText;
}
export interface SeoContentSection {
heading: LocalizedText;
body: LocalizedText;
}
export interface ProgrammaticToolPage {
slug: string;
toolSlug: string;
@@ -27,6 +36,7 @@ export interface ProgrammaticToolPage {
descriptionTemplate: LocalizedText;
faqTemplates: SeoFaqTemplate[];
relatedCollectionSlugs: string[];
contentSections?: SeoContentSection[];
}
export interface SeoCollectionPage {
@@ -39,18 +49,9 @@ export interface SeoCollectionPage {
targetToolSlugs: string[];
faqTemplates: SeoFaqTemplate[];
relatedCollectionSlugs: string[];
contentSections?: SeoContentSection[];
}
interface SeoToolsConfig {
toolPages: ProgrammaticToolPage[];
collectionPages: SeoCollectionPage[];
}
const config = seoToolsConfig as SeoToolsConfig;
export const PROGRAMMATIC_TOOL_PAGES = config.toolPages;
export const SEO_COLLECTION_PAGES = config.collectionPages;
export function normalizeSeoLocale(language: string): SeoLocale {
return language.toLowerCase().startsWith('ar') ? 'ar' : 'en';
}
@@ -85,4 +86,8 @@ export function getAllCollectionSeoPaths(): string[] {
export function getAllSeoLandingPaths(): string[] {
return [...getAllProgrammaticSeoPaths(), ...getAllCollectionSeoPaths()];
}
export function getAllLocalizedSeoLandingPaths(): string[] {
return [...getLocalizedSeoLandingPaths('en'), ...getLocalizedSeoLandingPaths('ar')];
}