Docs
BlogHomeStart building

SEO & IndexNow (totalum-sdk/seo)


import … from 'totalum-sdk/seo' — or the same namespace on totalum from 'totalum-sdk'. Install, configuration and errors: Totalum SDK.

Tell search engines that pages of your custom domain changed (IndexNow), so new and edited pages are indexed in minutes instead of days. Works on verified custom domains. Free.

ts
await totalum.seo.notifyChanged(['https://www.acme.com/blog/launch']);
Method or typeWhat it does
totalumSeoCreates the seo namespace (the same object as totalum.seo, scope seo): IndexNow for verified custom domains, free.
seo.notifyChangedTells the search engines that use IndexNow (Bing, Yandex, Seznam, Naver, …) that these pages of the project's custom domain were added or changed, so they are crawled again soon, and fetches each domain's /sitemap.xml so it is fresh.
seo.indexNowKeyThe project's IndexNow key: the template serves it at /<key>.txt so search engines can check the submissions are yours.
SeoIndexNowKeyThe project's IndexNow key.
SeoNotifyOutputThe answer of seo.notifyChanged().

#totalumSeo

ts
totalumSeo(options?: TotalumClientOptions): TotalumSeo

Creates the seo namespace (the same object as totalum.seo, scope seo): IndexNow for verified custom domains, free.

Parameters

NameTypeRequiredDescription
optionsTotalumClientOptionsnoThe project key, API URL and environment; each falls back to its environment variable.
options.keystringnoProject key tlm_pk_…; default TOTALUM_PROJECT_KEY. Server-side only.
options.apiUrlstringnoThe Totalum API's URL: default TOTALUM_SDK_API_URL, else https://sdk-api.totalum.app.
options.env'dev' | 'live'noSent as x-totalum-env on every call (the database it targets, and dev vs live usage); default TOTALUM_ENV, else live.

Returns TotalumSeo — The seo namespace: the methods below.

Example

ts
import { totalumSeo } from 'totalum-sdk/seo';

const seo = totalumSeo();
await seo.notifyChanged(['https://www.acme.com/blog/launch']);

The namespace's type is exported as TotalumSeo (import type { TotalumSeo } from 'totalum-sdk/seo').

#seo.notifyChanged

ts
seo.notifyChanged(urls: string[]): Promise<SeoNotifyOutput>

Tells the search engines that use IndexNow (Bing, Yandex, Seznam, Naver, …) that these pages of the project's custom domain were added or changed, so they are crawled again soon, and fetches each domain's /sitemap.xml so it is fresh. Call it after publishing a post or editing a product page. Only verified custom domains are sent: for Totalum's own hosts the answer is indexNow: 'skipped_no_custom_domain'. Free.

Parameters

NameTypeRequiredDescription
urlsstring[]yesFull URLs on the project's hostnames.

Returns Promise<SeoNotifyOutput> — How many URLs were accepted and what was sent.

FieldTypeAlways presentDescription
acceptednumberyesHow many URLs were sent to IndexNow.
indexNow'error' | 'sent' | 'skipped_no_custom_domain'yessent; skipped_no_custom_domain when the project has no verified custom domain (Totalum's own hosts are never sent); error when IndexNow refused them.
sitemapsPingedbooleanyesWhether each domain's /sitemap.xml answered.

Errors — besides the errors every call can throw:

CodeHTTPWhen
URL_NOT_PROJECT_HOST400A URL is not on one of the project's hostnames; details.url.
INDEXNOW_ERROR502IndexNow refused the submission.
ENGINE_UNAVAILABLE502SEO is unavailable; retry shortly.

Example

ts
const out = await totalum.seo.notifyChanged(['https://www.acme.com/blog/launch', 'https://www.acme.com/pricing']);

Result:

json
{ "accepted": 2, "indexNow": "sent", "sitemapsPinged": true }

#seo.indexNowKey

ts
seo.indexNowKey(): Promise<SeoIndexNowKey>

The project's IndexNow key: the template serves it at /<key>.txt so search engines can check the submissions are yours. Free.

Returns Promise<SeoIndexNowKey> — The key and the URL it is served at.

FieldTypeAlways presentDescription
keystringyesThe key.
keyLocationstringyesThe URL where the site serves it (https://<host>/<key>.txt).

Errors — besides the errors every call can throw:

CodeHTTPWhen
ENGINE_UNAVAILABLE502SEO is unavailable; retry shortly.

Example

ts
const { key, keyLocation } = await totalum.seo.indexNowKey();

Result:

json
{ "key": "99d8cc52…", "keyLocation": "https://acme.totalum.app/99d8cc52….txt" }

#SeoIndexNowKey type

The project's IndexNow key.

FieldTypeAlways presentDescription
keystringyesThe key.
keyLocationstringyesThe URL where the site serves it (https://<host>/<key>.txt).

#SeoNotifyOutput

The answer of seo.notifyChanged().

FieldTypeAlways presentDescription
acceptednumberyesHow many URLs were sent to IndexNow.
indexNow'error' | 'sent' | 'skipped_no_custom_domain'yessent; skipped_no_custom_domain when the project has no verified custom domain (Totalum's own hosts are never sent); error when IndexNow refused them.
sitemapsPingedbooleanyesWhether each domain's /sitemap.xml answered.