/** * SEO WordPress Client * * Extended WordPress REST API client with enhanced SEO capabilities. * Provides specialized methods for SEO metadata management, schema markup, * and integration with popular WordPress SEO plugins like Yoast and RankMath. * * Features: * - SEO metadata retrieval and updates via REST API * - Integration with Yoast SEO and RankMath plugin APIs * - Schema markup management through WordPress custom fields * - Bulk SEO operations with progress tracking * - SEO-specific data normalization and validation * - Plugin-agnostic metadata handling * * @since 2.7.0 */ import { WordPressClient } from "./api.js"; import type { WordPressPost, WordPressPage } from "../types/wordpress.js"; import type { WordPressClientConfig } from "../types/client.js"; import type { SEOMetadata, SchemaMarkup } from "../types/seo.js"; /** * SEO data structure for API responses (flattened format) */ interface SEODataResponse { postId: number; plugin: "yoast" | "rankmath" | "seopress" | "none"; title: string | null; description: string | null; canonical: string | null; focusKeyword: string | null; openGraph: { title: string | null; description: string | null; }; twitter: { title: string | null; description: string | null; }; schema?: SchemaMarkup | undefined; raw: Record; lastModified: string; success?: boolean; message?: string; } /** * Bulk SEO operation parameters */ interface BulkSEOParams { postIds: number[]; operation: "get" | "update"; metadata?: Partial; batchSize?: number; progressCallback?: (processed: number, total: number) => void; } /** * Extended WordPress client with SEO capabilities */ export declare class SEOWordPressClient extends WordPressClient { private logger; private detectedPlugin; private pluginFields; constructor(config?: Partial); /** * Initialize and detect SEO plugins */ initializeSEO(): Promise; /** * Derives a plugin slug from a /wp/v2/plugins entry. The REST response has no `slug` * field, so the slug is the directory segment of `plugin`: "seo-by-rank-math/rank-math" * yields "seo-by-rank-math". Matching the whole segment rather than a prefix keeps * "seo-by-rank-math-pro" from being mistaken for the base plugin. An explicit `slug`, * if some caller supplied one, takes precedence. */ private static pluginSlug; /** * Detect active SEO plugins on the WordPress site */ private detectSEOPlugins; /** * Get SEO metadata for a post or page */ getSEOMetadata(postId: number, type?: "post" | "page"): Promise; /** * Update SEO metadata for a post or page */ updateSEOMetadata(postId: number, metadata: Partial, type?: "post" | "page"): Promise; /** * Bulk get SEO metadata for multiple posts */ bulkGetSEOMetadata(params: BulkSEOParams): Promise; /** * Bulk update SEO metadata for multiple posts */ bulkUpdateSEOMetadata(params: BulkSEOParams & { metadata: Partial; }): Promise; /** * Get all posts with SEO metadata for site audit */ getAllPostsWithSEO(params?: { postTypes?: string[]; maxPosts?: number; includePages?: boolean; }): Promise>; /** * Extract SEO metadata from WordPress post/page object */ private extractSEOMetadata; /** * Extract schema markup from post meta */ private extractSchemaMarkup; /** * Prepare meta fields for SEO metadata update */ private prepareSEOMetaFields; /** * Extract meta value with array handling */ private extractMetaValue; /** * Get plugin-specific focus keyword field */ private getPluginFocusKeyword; /** * Get plugin-specific schema data field */ private getPluginSchemaData; /** * Get plugin-specific focus keyword field name */ private getPluginFocusKeywordField; /** * Test SEO plugin integration */ testSEOIntegration(): Promise<{ pluginDetected: string; canReadMetadata: boolean; canWriteMetadata: boolean; samplePostsWithSEO: number; errors?: string[]; }>; /** * Get integration status for SEO features */ getIntegrationStatus(): { hasPlugin: boolean; plugin: string; canReadMetadata: boolean; canWriteMetadata: boolean; features: { metaTags: boolean; schema: boolean; socialMedia: boolean; xmlSitemap: boolean; breadcrumbs: boolean; }; }; /** * Check if content has plugin-specific SEO data */ private hasPluginData; /** * Get raw plugin data for debugging purposes */ private getRawPluginData; } export {}; //# sourceMappingURL=SEOWordPressClient.d.ts.map