Component evidence

URL Normalization Utilities (audit/url-utils.ts)

open-seo · src/server/lib/audit/url-utils.ts · typescript · MIT
integrationscrapingcrmtag:urltag:normalizationtag:deduplication

Normalizes, canonicalizes, and compares URLs for crawler deduplication, including query sorting, hostname handling, and URL template detection.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/every-app/open-seo | License: MIT | Copyright 2026 Ben Senescu
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * URL normalization and utility functions for the site audit crawler.
 */

/**
 * Normalize a URL for deduplication:
 * - Resolve relative URLs against a base
 * - Strip fragments (#...)
 * - Sort query parameters
 * - Lowercase the hostname
 * - Preserve trailing slashes. A trailing slash is the canonical form on most
 *   CMS platforms (WordPress etc.), which 301-redirect the non-slash version to
 *   it. Stripping it here would rewrite the canonical URL into its own redirect
 *   source, so the crawler would follow /path -> /path/ and strip back to /path
 *   forever — a 508 loop. Keeping /path and /path/ distinct lets the red

... (truncated -- full source via MCP)