# Code Deb SEO SDK

**Verified registry:** `@codedeb/seo@0.2.0` remains publicly available. Target `0.2.2` requires a new registry verification.

**Public npm release:** [@codedeb/seo@0.2.0](https://www.npmjs.com/package/@codedeb/seo) · **Released:** 20 November 2026 · **ESM:** JavaScript + TypeScript declarations.

```bash
npm install @codedeb/seo
```

Read the [integration reference](/docs/sdk/seo) or [engineering guide](/blog/sdk-seo-structured-data-nepal). Code Deb's noncommercial SDK license applies to Code Deb-owned material; commercial use requires a separate agreement. Upstream notices are retained where applicable.

Typed generation of canonical page metadata, Open Graph previews, LocalBusiness structured data, locale alternates and XML sitemaps. The npm package is public, but it does not provide a hosted ranking or indexing service.

## Metadata

`createSeoMetadata` requires an absolute HTTPS canonical URL, meaningful title and description and optional image and locale alternates. `localBusinessJsonLd` accepts verified business details and safely serializes JSON-LD without executable HTML injection.

## Sitemap generation

`buildXmlSitemap` produces an escaped, deduplicated XML sitemap from indexable pages, supports published-language alternate URLs and accepts actual content modification timestamps. Ensure canonical URLs and allowed hosts are correct before publication.

```ts
import { createSeoMetadata, buildXmlSitemap, localBusinessJsonLd }
  from '@codedeb/seo';

const page = {
  url:'https://example.com/ne/services',
  title:'सेवाहरू | Example',
  description:'Services offered by our Nepal business.'
};
const metadata = createSeoMetadata(page);
const sitemap = buildXmlSitemap([page]);
```

## Search-engine notifications

`submitIndexNow` sends to participating engines only when the caller asserts verified hostname ownership; your application must independently prove it. `googleSitemapSubmission` builds a Search Console API request descriptor, not an OAuth token or an executed submission.

**Google's Indexing API is not appropriate for ordinary pages**; it has limited permitted content types. Sitemap and IndexNow notifications do not guarantee discovery, indexing, rankings or rich results.

## Measure against evidence

Use the existing [Code Deb SEO Auditor](/tools/seo-auditor) to review the actual delivered HTML and page issues. Use independently authorized Search Console data for impressions and indexing status; do not invent scores.

[SDK overview](/docs/sdk) | [SDK resources](/docs/sdk)

## Advanced structured data modules

`schema.ts` generates safe, typed `Product`, `Article` and `BreadcrumbList` JSON-LD from verified input. Prices are integer NPR paisa. Never populate fabricated reviews, stock status or product claims.

`sitemaps.ts` splits large URL sets into bounded sitemap files, creates sitemap indexes and builds robots.txt instructions. It uses linear single-URL entry serialization rather than repeatedly serializing entire chunks. XML outputs must be served from their declared canonical host.

`validate.ts` performs deterministic local page checks for duplicate canonicals, missing alternates and broken reciprocal hreflang. `html.ts` creates escaped first-paint head tags and JSON-LD.

```ts
import {productJsonLd} from '@codedeb/seo/schema';
import {splitSitemap,sitemapIndex} from '@codedeb/seo/sitemaps';
import {validateSeoPages} from '@codedeb/seo/validate';
import {renderSeoHead} from '@codedeb/seo/html';

const issues=validateSeoPages(publishedPages);
const maps=splitSitemap(publishedPages,{maxUrls:10000});
const html=renderSeoHead(publishedPages[0]);
```

## Search-provider boundaries

IndexNow requires domain ownership validation by the application; Google Search Console requests need real OAuth and site-property permission. None of these submissions guarantees indexing, rich results or a ranking position.

## Release history

- **0.2.0 — 20 November 2026:** First public Code Deb npm distribution. Independently packaged ESM exports and TypeScript declarations passed isolated consumer verification.

## Merchant listings and ProductGroup structured data (unreleased extension)

The upcoming `@codedeb/seo/merchant` entrypoint builds validated ProductGroup variant records and merchant shipping/return JSON-LD. This is staged for a future immutable SEO SDK release; older published versions do not contain this entrypoint.

```ts
import {productGroupJsonLd,merchantReturnPolicyJsonLd,shippingDetailsJsonLd} from '@codedeb/seo/merchant';
const data=productGroupJsonLd({
 url:'https://shop.example.com/tea',name:'Nepal Tea',description:'Single-estate leaves',
 groupId:'TEA',variants:[{sku:'TEA-S',name:'Tea Small',url:'https://shop.example.com/tea/s',
 image:'https://shop.example.com/tea.webp',pricePaisa:14500,available:true,size:'Small'}],
});
console.log(JSON.parse(data)['@type']); // ProductGroup
```

Actual variants, prices, seller policies and destinations must be truthful. The SDK cannot guarantee a Google rich result or Merchant Center approval.

Standards: [Google Product variants](https://developers.google.com/search/docs/appearance/structured-data/product-variants), [Merchant listings](https://developers.google.com/search/docs/appearance/structured-data/merchant-listing).

## Production implementation walkthrough

1. Generate canonicals only for actual indexable public routes.
2. Create schema.org data from verified products, people and business details.
3. Split localized sitemaps deterministically and reconcile hreflang alternates.
4. Verify performance in Search Console; schema is not a ranking guarantee.

## Reproducible installation and compatibility

```bash
npm view @codedeb/seo@0.2.0 version
npm install @codedeb/seo@0.2.0
```

Pin the exact version in the application lockfile; review its exported ESM subpaths and bundled TypeScript declarations. A new package version does not retroactively update older immutable tarballs.

## Integration acceptance checklist

- Validate boundary inputs, invalid payloads and every caller-provided adapter before connecting customer data.
- Type-check the actual package from a clean test application, not only from this monorepo's source paths.
- Exercise authorization failures, missing configuration and relevant concurrency or retry paths.
- Keep credential and sensitive data out of logs; store only necessary operational evidence.

## Troubleshooting and version policy

**Module not found:** Check the exact import subpath and package version in `node_modules` and the lockfile. **Unexpected result:** Review the required application-owned credentials and adapters. **npm 404:** Verify the requested immutable version using the public registry; do not mistake a local tarball for a published release.

## Related integration guides

See [seo audit](/docs/sdk/seo-audit) and [search console](/docs/sdk/search-console) for complementary capabilities. Use the [SDK directory](/docs/sdk) and [Developer resources](/docs/resources) for API references and engineering guides.
