/** * SEO utilities — sitemap.xml and robots.txt generation. * * @module */ export interface SitemapEntry { /** URL path, e.g. "/docs/getting-started/introduction". */ url: string; /** Last modification date (ISO 8601 or YYYY-MM-DD). */ lastmod?: string; /** Change frequency: always, hourly, daily, weekly, monthly, yearly, never. */ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never"; /** Priority 0.0–1.0. */ priority?: number; } export interface SitemapConfig { /** Base URL of the site, e.g. "https://example.com". */ siteUrl: string; /** List of URL entries to include in the sitemap. */ urls: (SitemapEntry | string)[]; /** Output directory where sitemap.xml will be written. */ outDir: string; } export interface RobotsConfig { /** Base URL of the site, e.g. "https://example.com". */ siteUrl: string; /** Output directory where robots.txt will be written. */ outDir: string; /** Rules for specific user agents. */ rules?: RobotsRule[]; /** Paths to disallow for all crawlers (shorthand for rules). */ disallow?: string[]; /** Sitemap URL override. If not set, defaults to `${siteUrl}/sitemap.xml`. */ sitemapUrl?: string; } export interface RobotsRule { /** User-agent, e.g. "Googlebot" or "*" for all. */ userAgent: string; /** Paths to disallow. */ disallow?: string[]; /** Paths to allow. */ allow?: string[]; /** Crawl delay in seconds. */ crawlDelay?: number; } /** * Generates a `sitemap.xml` file from a list of URLs. * * @example * ```ts * import { generateSitemap } from "@deijose/nix-js-kit/seo"; * * await generateSitemap({ * siteUrl: "https://nix-js-kit.dev", * outDir: "./dist", * urls: [ * "/", * "/docs/introduction", * { url: "/docs/routing", changefreq: "weekly", priority: 0.8 }, * ], * }); * ``` */ export declare function generateSitemap(config: SitemapConfig): Promise; /** * Generates a `robots.txt` file. * * @example * ```ts * import { generateRobots } from "@deijose/nix-js-kit/seo"; * * await generateRobots({ * siteUrl: "https://nix-js-kit.dev", * outDir: "./dist", * disallow: ["/api/", "/_nix-js/"], * }); * ``` */ export declare function generateRobots(config: RobotsConfig): Promise; export interface JsonLdSchema { [key: string]: unknown; } /** * Serializes a JSON-LD structured data object into a ` * ``` */ export declare function jsonLd(schema: JsonLdSchema | JsonLdSchema[]): string;