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.
await totalum.seo.notifyChanged(['https://www.acme.com/blog/launch']);| Method or type | What it does |
|---|---|
totalumSeo | Creates the seo namespace (the same object as totalum.seo, scope seo): IndexNow for verified custom domains, free. |
seo.notifyChanged | 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. |
seo.indexNowKey | The project's IndexNow key: the template serves it at /<key>.txt so search engines can check the submissions are yours. |
SeoIndexNowKey | The project's IndexNow key. |
SeoNotifyOutput | The answer of seo.notifyChanged(). |
#totalumSeo
totalumSeo(options?: TotalumClientOptions): TotalumSeoCreates the seo namespace (the same object as totalum.seo, scope seo): IndexNow for verified custom domains,
free.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options | TotalumClientOptions | no | The project key, API URL and environment; each falls back to its environment variable. |
options.key | string | no | Project key tlm_pk_…; default TOTALUM_PROJECT_KEY. Server-side only. |
options.apiUrl | string | no | The Totalum API's URL: default TOTALUM_SDK_API_URL, else https://sdk-api.totalum.app. |
options.env | 'dev' | 'live' | no | Sent 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
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
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
| Name | Type | Required | Description |
|---|---|---|---|
urls | string[] | yes | Full URLs on the project's hostnames. |
Returns Promise<SeoNotifyOutput> — How many URLs were accepted and what was sent.
| Field | Type | Always present | Description |
|---|---|---|---|
accepted | number | yes | How many URLs were sent to IndexNow. |
indexNow | 'error' | 'sent' | 'skipped_no_custom_domain' | yes | sent; skipped_no_custom_domain when the project has no verified custom domain (Totalum's own hosts are never sent); error when IndexNow refused them. |
sitemapsPinged | boolean | yes | Whether each domain's /sitemap.xml answered. |
Errors — besides the errors every call can throw:
| Code | HTTP | When |
|---|---|---|
URL_NOT_PROJECT_HOST | 400 | A URL is not on one of the project's hostnames; details.url. |
INDEXNOW_ERROR | 502 | IndexNow refused the submission. |
ENGINE_UNAVAILABLE | 502 | SEO is unavailable; retry shortly. |
Example
const out = await totalum.seo.notifyChanged(['https://www.acme.com/blog/launch', 'https://www.acme.com/pricing']);Result:
{ "accepted": 2, "indexNow": "sent", "sitemapsPinged": true }#seo.indexNowKey
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.
| Field | Type | Always present | Description |
|---|---|---|---|
key | string | yes | The key. |
keyLocation | string | yes | The URL where the site serves it (https://<host>/<key>.txt). |
Errors — besides the errors every call can throw:
| Code | HTTP | When |
|---|---|---|
ENGINE_UNAVAILABLE | 502 | SEO is unavailable; retry shortly. |
Example
const { key, keyLocation } = await totalum.seo.indexNowKey();Result:
{ "key": "99d8cc52…", "keyLocation": "https://acme.totalum.app/99d8cc52….txt" }#SeoIndexNowKey type
The project's IndexNow key.
| Field | Type | Always present | Description |
|---|---|---|---|
key | string | yes | The key. |
keyLocation | string | yes | The URL where the site serves it (https://<host>/<key>.txt). |
#SeoNotifyOutput
The answer of seo.notifyChanged().
| Field | Type | Always present | Description |
|---|---|---|---|
accepted | number | yes | How many URLs were sent to IndexNow. |
indexNow | 'error' | 'sent' | 'skipped_no_custom_domain' | yes | sent; skipped_no_custom_domain when the project has no verified custom domain (Totalum's own hosts are never sent); error when IndexNow refused them. |
sitemapsPinged | boolean | yes | Whether each domain's /sitemap.xml answered. |
