{"_id":"@brandonhimpfen/seo-utils","name":"@brandonhimpfen/seo-utils","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@brandonhimpfen/seo-utils","version":"0.1.0","description":"General-purpose helper functions for common SEO tasks.","type":"module","main":"src/index.js","exports":{".":"./src/index.js"},"scripts":{"test":"node --test"},"keywords":["seo","metadata","slug","canonical","robots","open graph","utility"],"repository":{"type":"git","url":"git+https://github.com/brandonhimpfen/seo-utils.git"},"bugs":{"url":"https://github.com/brandonhimpfen/seo-utils/issues"},"homepage":"https://github.com/brandonhimpfen/seo-utils#readme","author":{"name":"Brandon Himpfen"},"license":"MIT","gitHead":"7ededf84962c421e921e10835ea4ecee89222273","_id":"@brandonhimpfen/seo-utils@0.1.0","_nodeVersion":"25.8.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-vx5o3DwILGDqVna18cbQUccUrWSGCxyavEfp2a/H6vCI62vOGBJ+hfwsTmDL/Uw88Ulup1mN0j66jEen+SInBg==","shasum":"cb4560217e11b6b4946e5ff8d776adb34bfcb330","tarball":"https://registry.npmjs.org/@brandonhimpfen/seo-utils/-/seo-utils-0.1.0.tgz","fileCount":4,"unpackedSize":8789,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGHawZk1hah76l5o3vaAWt5XFAGFepEj+zxXbaOmu3WCAiBIsNX5DSmf4ydN0Z1qOaxZZCpLEKQmSqfuvINoKMEu5Q=="}]},"_npmUser":{"name":"brandonhimpfen","email":"brandon@himpfen.com"},"directories":{},"maintainers":[{"name":"brandonhimpfen","email":"brandon@himpfen.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/seo-utils_0.1.0_1774748719326_0.21528581804960556"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-29T01:45:19.270Z","0.1.0":"2026-03-29T01:45:19.474Z","modified":"2026-03-29T01:45:19.646Z"},"maintainers":[{"name":"brandonhimpfen","email":"brandon@himpfen.com"}],"description":"General-purpose helper functions for common SEO tasks.","homepage":"https://github.com/brandonhimpfen/seo-utils#readme","keywords":["seo","metadata","slug","canonical","robots","open graph","utility"],"repository":{"type":"git","url":"git+https://github.com/brandonhimpfen/seo-utils.git"},"author":{"name":"Brandon Himpfen"},"bugs":{"url":"https://github.com/brandonhimpfen/seo-utils/issues"},"license":"MIT","readme":"# seo-utils\n\nA lightweight utility library for common SEO tasks.\n\n`seo-utils` provides small, focused helper functions for tasks that appear frequently in content systems, static sites, publishing workflows, and web applications. It is designed to help normalize and generate common SEO values without requiring a large framework.\n\n## Why this project exists\n\nSEO-related logic is often repeated across applications.\n\nOne project trims titles manually. Another generates slugs in a slightly different way. A third assembles canonical URLs with custom string logic. Over time, these small inconsistencies create unnecessary duplication and make content systems harder to maintain.\n\nThis package provides a simple set of reusable helpers for common SEO tasks.\n\n## What is included\n\n- Slug generation.\n- Title normalization.\n- Meta description trimming.\n- Canonical URL normalization.\n- Robots directive formatting.\n- Open Graph image alt fallback helper.\n- Basic tests.\n- Example usage.\n\n## Install\n\n```bash\nnpm install @brandonhimpfen/seo-utils\n```\n\n## Example\n\n```js\nimport {\n  slugify,\n  normalizeTitle,\n  trimMetaDescription,\n  normalizeCanonicalUrl,\n  formatRobotsDirectives\n} from \"@brandonhimpfen/seo-utils\";\n\nconst slug = slugify(\"The Future of AI Infrastructure\");\nconst title = normalizeTitle(\"AI Infrastructure\", \"Brandon Himpfen\");\nconst description = trimMetaDescription(\n  \"A practical overview of the software, systems, and infrastructure layers that make AI usable at scale.\",\n  160\n);\nconst canonical = normalizeCanonicalUrl(\"https://www.example.com/blog/ai-infrastructure/\");\nconst robots = formatRobotsDirectives({\n  index: true,\n  follow: true,\n  maxSnippet: 160\n});\n\nconsole.log({ slug, title, description, canonical, robots });\n```\n\n## Design Principles\n\nThis project is intentionally minimal.\n\nIt focuses on common, reusable SEO helpers rather than full SEO frameworks or site generators. The goal is to provide reliable utilities that can be used across different systems without introducing unnecessary abstraction.\n\nThe design emphasizes:\n\n- Simplicity over feature creep.\n- Predictable outputs over magic behavior.\n- Reusability across publishing workflows.\n- Clear interfaces over configuration-heavy APIs.\n\n## API\n\n### `slugify(input, options?)`\n\nConvert a string into a URL-friendly slug.\n\n### `normalizeTitle(title, siteName?, options?)`\n\nBuild a title string with optional site branding and maximum length handling.\n\n### `trimMetaDescription(input, maxLength?)`\n\nTrim a description to a target length without cutting words abruptly when possible.\n\n### `normalizeCanonicalUrl(input, options?)`\n\nNormalize a canonical URL by removing duplicate slashes, optionally stripping query strings and hashes, and handling trailing slashes consistently.\n\n### `formatRobotsDirectives(directives)`\n\nFormat a robots directive object into a comma-separated string.\n\n### `getOgImageAlt(input, fallback?)`\n\nReturn a usable Open Graph image alt string with a fallback when needed.\n\n## Roadmap\n\nFuture extensions may include:\n\n- JSON-LD helper generation.\n- hreflang utilities.\n- sitemap helpers.\n- breadcrumb structured data helpers.\n- social meta normalization.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-c0e7a0bf6164479f37b42e3c6d17596c"}