/** * Settings validation schema for RobotsIndexing * Auto-generated from baseline.json * * @module TechnicalSEO/RobotsIndexing * @since 0.1.0 */ import { z } from 'zod'; /** * Settings schema for RobotsIndexing */ export const RobotsIndexingSchema = z.object({ enable_robots_txt: z.boolean().default(true), // Enable virtual robots.txt file robots_txt_content: z.string().default('User-agent: *\nDisallow: /wp-admin/\nAllow: /wp-admin/admin-ajax.php\n'), // Custom robots.txt content default_robots_meta: z.object({ index: z.boolean(), follow: z.boolean(), archive: z.boolean(), snippet: z.boolean(), imageindex: z.boolean() }).default({"index":true,"follow":true,"archive":true,"snippet":true,"imageindex":true}), // Default robots meta settings noindex_settings: z.object({ search_results: z.boolean(), pages_404: z.boolean(), attachment_pages: z.boolean(), paginated_archives: z.boolean(), author_archives: z.boolean(), date_archives: z.boolean(), tag_archives: z.boolean(), category_archives: z.boolean() }).default({"search_results":true,"pages_404":true,"attachment_pages":true,"paginated_archives":false,"author_archives":false,"date_archives":false,"tag_archives":false,"category_archives":false}), // Pages to set as noindex crawl_delay: z.number().int().min(0).max(10).default(0), // Crawl delay in seconds max_snippet_length: z.number().int().min(-1).max(320).default(-1), // Maximum snippet length (-1 for unlimited) max_image_preview: z.enum(['none', 'standard', 'large']).default('large'), // Maximum image preview size max_video_preview: z.number().int().min(-1).max(120).default(-1), // Maximum video preview in seconds block_ai_bots: z.boolean().default(false), // Block AI/ML training bots from crawling the site }); /** * TypeScript type for RobotsIndexing settings */ export type RobotsIndexingSettings = z.infer; /** * Default values for RobotsIndexing settings */ export const RobotsIndexingDefaults: RobotsIndexingSettings = RobotsIndexingSchema.parse({}); /** * Validate RobotsIndexing settings */ export function validateRobotsIndexingSettings(data: unknown): RobotsIndexingSettings { return RobotsIndexingSchema.parse(data); } /** * Safely validate RobotsIndexing settings (returns validation result) */ export function safeValidateRobotsIndexingSettings(data: unknown) { return RobotsIndexingSchema.safeParse(data); }