@ai-growth/nextjs
Version:
Seamlessly integrate Sanity CMS with Next.js applications for automated blog routing and rendering
75 lines • 1.99 kB
TypeScript
/**
* @fileoverview URL Utilities for SEO
*
* This module provides functions for building and processing URLs
* for SEO purposes, including canonical URLs and URL normalization.
*/
import { URLBuildOptions } from '../../types/seo';
/**
* Build a complete URL from components
*
* @param options - URL building options
* @returns Complete URL string
*/
export declare function buildURL(options: URLBuildOptions): string;
/**
* Normalize a URL for canonical purposes
*
* @param url - URL to normalize
* @returns Normalized URL
*/
export declare function normalizeURL(url: string): string;
/**
* Extract domain from URL
*
* @param url - URL to extract domain from
* @returns Domain string
*/
export declare function extractDomain(url: string): string;
/**
* Check if URL is absolute
*
* @param url - URL to check
* @returns Whether URL is absolute
*/
export declare function isAbsoluteURL(url: string): boolean;
/**
* Convert relative URL to absolute
*
* @param relativeUrl - Relative URL
* @param baseUrl - Base URL for resolution
* @returns Absolute URL
*/
export declare function makeAbsoluteURL(relativeUrl: string, baseUrl: string): string;
/**
* Generate SEO-friendly URL slug from text
*
* @param text - Text to convert to slug
* @param maxLength - Maximum length of slug
* @returns URL slug
*/
export declare function createSlug(text: string, maxLength?: number): string;
/**
* Validate URL format
*
* @param url - URL to validate
* @returns Validation result
*/
export declare function validateURL(url: string): {
isValid: boolean;
errors: string[];
warnings: string[];
};
/**
* Build breadcrumb URLs from path
*
* @param currentUrl - Current page URL
* @param baseUrl - Base site URL
* @returns Array of breadcrumb URLs with labels
*/
export declare function buildBreadcrumbUrls(currentUrl: string, baseUrl: string): Array<{
url: string;
label: string;
position: number;
}>;
//# sourceMappingURL=url-utils.d.ts.map