Type-safe, dependency-free SEO utilities for JavaScript and TypeScript — slugs, SERP checks, heading audits, URL normalization, metadata extraction, image audits, robots.txt parsing, sitemap extraction, and more.
Built for CMS plugins, content editors, marketing dashboards, and CLI tools that need predictable outputs and stable warning codes (map them to any UI language).

npm install @jvpdls/seo-tools
Requires Node.js 18+. ESM only. Zero runtime dependencies.
Ship a slug, validate a SERP snippet, and parse technical SEO inputs in a few lines:
import {
analyzeImages,
analyzeMetaTags,
analyzeSerpSnippet,
buildUtmUrl,
createSlug,
extractSitemapUrls,
normalizeUrl,
} from '@jvpdls/seo-tools';
const { slug } = createSlug({
text: 'How to write a clear project brief for clients',
maxWords: 6,
removeStopwords: true,
});
const serp = analyzeSerpSnippet({
title: 'How to write a clear project brief',
description:
'Learn how to create a project brief that aligns scope, timelines, and next steps.',
keyword: 'project brief',
});
const { normalizedUrl } = normalizeUrl({
url: 'HTTPS://Example.com/blog/?utm_source=google&id=1#top',
removeTrackingParams: true,
forceLowercaseUrl: true,
removeHash: true,
});
const campaign = buildUtmUrl({
url: 'https://example.com/guide',
params: {
utm_source: 'newsletter',
utm_medium: 'email',
utm_campaign: 'brief-guide',
},
});
const meta = analyzeMetaTags({
html: `
<title>Internal SEO Tool</title>
<meta name="description" content="Fast technical SEO checks." />
<meta name="robots" content="index, follow" />
<link rel="canonical" href="https://example.com/tool" />
`,
});
const sitemap = extractSitemapUrls({
xml: `
<urlset>
<url><loc>https://example.com/</loc></url>
<url><loc>https://example.com/blog</loc></url>
</urlset>
`,
});
const images = analyzeImages({
html: '<img src="/hero.jpg" alt="Hero" width="1200" height="630" loading="lazy" />',
});
Import only what you need via domain subpaths or the full API table below.
| Function |
One-line purpose |
normalizeUrl |
Canonical URLs, strip tracking params |
buildUtmUrl |
Append UTM / campaign query params |
| Function |
One-line purpose |
cleanHtml |
Strip classes, ids, inline styles |
countLinks |
Internal, external, nofollow link counts |
Full reference: docs/
Tree-shake by domain when bundling editors or microservices:
import { createSlug } from '@jvpdls/seo-tools/text';
import { analyzeSerpSnippet } from '@jvpdls/seo-tools/serp';
import { analyzeHeadings } from '@jvpdls/seo-tools/headings';
import { normalizeUrl } from '@jvpdls/seo-tools/url';
import { countLinks } from '@jvpdls/seo-tools/html';
import { analyzeMetaTags } from '@jvpdls/seo-tools/meta';
import { analyzeImages } from '@jvpdls/seo-tools/images';
import { analyzeRobotsRules } from '@jvpdls/seo-tools/robots';
import { extractSitemapUrls } from '@jvpdls/seo-tools/sitemap';
import { buildWebsiteSchema } from '@jvpdls/seo-tools/schema';
| Need |
Utility |
| Publish-ready permalink |
createSlug |
| Editor word count & reading time |
countTextMetrics |
| Avoid thin or stuffed copy |
analyzeKeywordDensity |
| Pre-flight title & description |
analyzeSerpSnippet |
| Consistent branded titles |
buildPageTitle |
| Content outline / TOC |
extractHeadings |
| On-page hierarchy QA |
analyzeHeadings |
| Dedupe URLs in crawls |
normalizeUrl |
| Campaign links |
buildUtmUrl |
| Sanitize pasted HTML |
cleanHtml |
| Internal linking reports |
countLinks |
| Head metadata audit |
analyzeMetaTags |
| Image accessibility / loading checks |
analyzeImages |
Parse robots.txt |
extractRobotsRules, matchRobotsPath |
| Parse sitemap XML |
extractSitemapUrls, analyzeSitemap |
| JSON-LD for core page types |
buildWebsiteSchema, buildArticleSchema, … |
All analyzers return warningCodes — stable string enums you localize in the app layer, not in the library.
- Images: recover original sources from Next.js
/_next/image URLs, including overrideSrc output
- Images: recognize Next.js
fill, preload, and high fetch priority without false missing-dimension or missing-loading warnings
- Meta: added metadata extraction and audits (
extractMetaTags, extractCanonical, extractMetaRobots, analyzeMetaTags)
- Images: added
<img> extraction and image audits (extractImages, analyzeImageAlts, analyzeImageDimensions, analyzeImageLoading, analyzeImages)
- Robots: added
robots.txt parsing, sitemap extraction, path matching, and batch URL audits (extractRobotsRules, extractRobotsSitemaps, analyzeRobotsRules, analyzeRobotsUrls, matchRobotsPath)
- Sitemap: added XML extraction and diagnostics (
detectSitemapType, extractSitemapUrls, extractSitemapMetadata, extractChildSitemaps, analyzeSitemap)
- Docs: added new domain guides for meta, images, robots, and sitemap
- Schema: added JSON-LD utilities
- Schema: added builders for
WebSite, WebPage, Article (& variations), FAQPage, AboutPage, and ContactPage
- Docs: added schema examples and API reference
- Development: installed and configured eslint
- README: clearer project title for GitHub and npm discovery
- Domain-based layout (
text, serp, headings, url, html subpaths)
- HTML utilities:
cleanHtml, countLinks
- Text:
analyzeKeywordDensity
- URL:
buildUtmUrl
- SERP:
buildPageTitle
- Per-domain API docs in
docs/
- Internal cleanup and small package adjustments
git clone https://github.com/jvpdls/seo-tools.git
cd seo-tools
npm install
npm run build
npm test
MIT João Santos