@power-seo/sitemap 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +378 -362
- package/dist/index.cjs +25 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,362 +1,378 @@
|
|
|
1
|
-
# @power-seo/sitemap — XML Sitemap Generator for TypeScript — Streaming, Index Splitting & Image/Video/News Extensions
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@power-seo/sitemap)
|
|
4
|
-
[](https://www.npmjs.com/package/@power-seo/sitemap)
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://bundlephobia.com/package/@power-seo/sitemap)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
**@power-seo/sitemap** is a zero-dependency XML sitemap generator for TypeScript that helps you generate standards-compliant sitemaps with image, video, and news extensions — including streaming generation and automatic index splitting for large sites.
|
|
14
|
-
|
|
15
|
-
**What it does**
|
|
16
|
-
|
|
17
|
-
- ✅ **
|
|
18
|
-
- ✅ **
|
|
19
|
-
- ✅ **
|
|
20
|
-
- ✅ **
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
**
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- **
|
|
53
|
-
- **
|
|
54
|
-
- **
|
|
55
|
-
- **
|
|
56
|
-
- **
|
|
57
|
-
- **
|
|
58
|
-
- **
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- **
|
|
129
|
-
- **
|
|
130
|
-
- **
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
**
|
|
167
|
-
- **
|
|
168
|
-
- **
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
|
199
|
-
|
|
200
|
-
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
|
209
|
-
|
|
|
210
|
-
| [`@power-seo/
|
|
211
|
-
| [`@power-seo/
|
|
212
|
-
| [`@power-seo/
|
|
213
|
-
| [`@power-seo/
|
|
214
|
-
| [`@power-seo/
|
|
215
|
-
| [`@power-seo/
|
|
216
|
-
| [`@power-seo/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
|
221
|
-
|
|
222
|
-
|
|
|
223
|
-
|
|
|
224
|
-
|
|
|
225
|
-
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
**
|
|
242
|
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
---
|
|
338
|
-
|
|
339
|
-
##
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
1
|
+
# @power-seo/sitemap — XML Sitemap Generator for TypeScript — Streaming, Index Splitting & Image/Video/News Extensions
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@power-seo/sitemap)
|
|
4
|
+
[](https://www.npmjs.com/package/@power-seo/sitemap)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://bundlephobia.com/package/@power-seo/sitemap)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
**@power-seo/sitemap** is a zero-dependency XML sitemap generator for TypeScript that helps you generate standards-compliant sitemaps with image, video, and news extensions — including streaming generation and automatic index splitting for large sites.
|
|
14
|
+
|
|
15
|
+
**What it does**
|
|
16
|
+
|
|
17
|
+
- ✅ **Generate XML sitemaps** — `generateSitemap()` produces spec-compliant `<urlset>` XML strings
|
|
18
|
+
- ✅ **Stream large sitemaps** — `streamSitemap()` yields XML chunks with constant memory usage
|
|
19
|
+
- ✅ **Split into multiple files** — `splitSitemap()` auto-chunks at the 50,000-URL limit
|
|
20
|
+
- ✅ **Generate sitemap indexes** — `generateSitemapIndex()` creates `<sitemapindex>` files pointing to child sitemaps
|
|
21
|
+
- ✅ **Validate URL entries** — `validateSitemapUrl()` checks against Google's sitemap spec requirements
|
|
22
|
+
|
|
23
|
+
**What it is not**
|
|
24
|
+
|
|
25
|
+
- ❌ **Not a sitemap crawler** — does not discover URLs by crawling your site
|
|
26
|
+
- ❌ **Not a submission client** — use `@power-seo/search-console` to submit sitemaps to GSC
|
|
27
|
+
|
|
28
|
+
**Recommended for**
|
|
29
|
+
|
|
30
|
+
- **Next.js App Router sites**, **Remix apps**, **Express servers**, **static site generators**, and any Node.js/edge environment that generates sitemaps programmatically
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Why @power-seo/sitemap Matters
|
|
35
|
+
|
|
36
|
+
**The problem**
|
|
37
|
+
|
|
38
|
+
- **Sites with 50,000+ URLs** cannot fit in a single sitemap file — the spec mandates splitting
|
|
39
|
+
- **Image and video sitemaps** require `<image:image>` and `<video:video>` namespace extensions that most generators don't support
|
|
40
|
+
- **Memory spikes** during XML string concatenation cause crashes or timeouts on large e-commerce catalogs
|
|
41
|
+
|
|
42
|
+
**Why developers care**
|
|
43
|
+
|
|
44
|
+
- **SEO:** Well-structured sitemaps improve crawl coverage and ensure all pages are discovered
|
|
45
|
+
- **Performance:** Streaming generation keeps memory usage constant for million-URL datasets
|
|
46
|
+
- **Indexing:** Image sitemaps help Google discover and index product images for Google Images
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Key Features
|
|
51
|
+
|
|
52
|
+
- **Full sitemap spec support** — `<loc>`, `<lastmod>`, `<changefreq>`, `<priority>`, and all optional elements
|
|
53
|
+
- **Image sitemap extension** — `<image:image>` tags with `loc`, `caption`, `title`, `license`
|
|
54
|
+
- **Video sitemap extension** — `<video:video>` tags with title, description, thumbnail, duration
|
|
55
|
+
- **News sitemap extension** — `<news:news>` tags with publication name, language, date
|
|
56
|
+
- **Streaming generation** — `streamSitemap()` returns `AsyncIterable<string>` — no memory spike on large lists
|
|
57
|
+
- **Automatic index splitting** — `splitSitemap()` chunks at `MAX_URLS_PER_SITEMAP` (50,000)
|
|
58
|
+
- **Sitemap index generation** — `generateSitemapIndex()` creates a `<sitemapindex>` pointing to child sitemaps
|
|
59
|
+
- **URL validation** — `validateSitemapUrl()` returns `{ valid, errors, warnings }` without throwing
|
|
60
|
+
- **Constants exported** — `MAX_URLS_PER_SITEMAP` (50,000) and `MAX_SITEMAP_SIZE_BYTES` (50MB)
|
|
61
|
+
- **Framework-agnostic** — works in Next.js API routes, Remix loaders, Express, Fastify, and edge runtimes
|
|
62
|
+
- **Full TypeScript support** — typed `SitemapURL`, `SitemapImage`, `SitemapVideo`, `SitemapNews`, `SitemapConfig`
|
|
63
|
+
- **Zero runtime dependencies** — pure TypeScript, no external XML libraries
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Benefits of Using @power-seo/sitemap
|
|
68
|
+
|
|
69
|
+
- **Improved crawl coverage**: Well-structured sitemaps with `lastmod` help Googlebot prioritize fresh pages
|
|
70
|
+
- **Better image indexing**: `<image:image>` extensions surface product images in Google Images
|
|
71
|
+
- **Safer implementation**: `validateSitemapUrl()` catches out-of-range `priority` values and invalid dates before serving
|
|
72
|
+
- **Faster delivery**: Zero-dependency streaming generation works in any runtime without configuration
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Quick Start
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { generateSitemap } from '@power-seo/sitemap';
|
|
80
|
+
|
|
81
|
+
const xml = generateSitemap({
|
|
82
|
+
urls: [
|
|
83
|
+
{ loc: 'https://example.com/', lastmod: '2026-01-01', changefreq: 'daily', priority: 1.0 },
|
|
84
|
+
{ loc: 'https://example.com/about', changefreq: 'monthly', priority: 0.8 },
|
|
85
|
+
{ loc: 'https://example.com/blog/post-1', lastmod: '2026-01-15', priority: 0.6 },
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Returns valid XML string:
|
|
90
|
+
// <?xml version="1.0" encoding="UTF-8"?>
|
|
91
|
+
// <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">...
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**What you should see**
|
|
95
|
+
|
|
96
|
+
- A standards-compliant XML sitemap string ready to serve as `Content-Type: application/xml`
|
|
97
|
+
- `<urlset>` containing `<url>` entries with the fields you provided
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Installation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm i @power-seo/sitemap
|
|
105
|
+
# or
|
|
106
|
+
yarn add @power-seo/sitemap
|
|
107
|
+
# or
|
|
108
|
+
pnpm add @power-seo/sitemap
|
|
109
|
+
# or
|
|
110
|
+
bun add @power-seo/sitemap
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Framework Compatibility
|
|
116
|
+
|
|
117
|
+
**Supported**
|
|
118
|
+
|
|
119
|
+
- ✅ Next.js App Router — use in `app/sitemap.xml/route.ts` API route
|
|
120
|
+
- ✅ Next.js Pages Router — use in `pages/api/sitemap.xml.ts`
|
|
121
|
+
- ✅ Remix — use in resource routes
|
|
122
|
+
- ✅ Node.js 18+ — pure TypeScript, no native bindings
|
|
123
|
+
- ✅ Edge runtimes — no `fs`, no `path`, no Node.js-specific APIs (except `streamSitemap` which uses `AsyncIterable`)
|
|
124
|
+
- ✅ Fastify / Express — serve the XML string as response body
|
|
125
|
+
|
|
126
|
+
**Environment notes**
|
|
127
|
+
|
|
128
|
+
- **SSR/SSG:** Fully supported — generate at request time or at build time
|
|
129
|
+
- **Edge runtime:** `generateSitemap()` and `generateSitemapIndex()` are edge-compatible; `streamSitemap()` requires Node.js streams if writing to disk
|
|
130
|
+
- **Browser-only usage:** Not applicable — sitemap generation is a server-side concern
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Use Cases
|
|
135
|
+
|
|
136
|
+
- **Next.js SSG sites** — generate a full sitemap from your CMS at build time
|
|
137
|
+
- **E-commerce catalogs** — product image sitemaps with `<image:image>` for every listing
|
|
138
|
+
- **News publishers** — `<news:news>` extension for Google News sitemap submission
|
|
139
|
+
- **Multi-locale sites** — separate sitemaps per locale with a unified sitemap index
|
|
140
|
+
- **Programmatic SEO** — generate sitemaps for thousands of auto-generated pages
|
|
141
|
+
- **Large sites** — automatic splitting at 50,000 URLs per file with index generation
|
|
142
|
+
- **Video platforms** — `<video:video>` extension for YouTube-style video SEO
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Example (Before / After)
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
Before:
|
|
150
|
+
- Hand-built XML strings: missing namespace declarations, wrong date formats
|
|
151
|
+
- Single 80,000-URL sitemap: invalid per spec (max 50,000), Google truncates
|
|
152
|
+
- No image sitemap: product images not discovered by Googlebot Images
|
|
153
|
+
|
|
154
|
+
After (@power-seo/sitemap):
|
|
155
|
+
- generateSitemap({ urls }) → spec-compliant XML with correct namespace
|
|
156
|
+
- splitSitemap(allUrls) + generateSitemapIndex() → auto-split + index file
|
|
157
|
+
- urls[i].images = [{ loc, caption }] → <image:image> tags for each product
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Implementation Best Practices
|
|
163
|
+
|
|
164
|
+
- **Always include `lastmod`** — Googlebot uses it to prioritize re-crawling updated pages
|
|
165
|
+
- **Keep `priority` values realistic** — setting everything to 1.0 signals ignored priority; reserve 1.0 for the homepage
|
|
166
|
+
- **Use `changefreq: 'never'` for permanent content** — signals Googlebot to skip re-crawling
|
|
167
|
+
- **Set `sitemap.xml` URL in `robots.txt`** — `Sitemap: https://example.com/sitemap.xml` is required for discovery
|
|
168
|
+
- **Submit to Google Search Console** after generating — use `@power-seo/search-console` `submitSitemap()`
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Architecture Overview
|
|
173
|
+
|
|
174
|
+
**Where it runs**
|
|
175
|
+
|
|
176
|
+
- **Build-time**: Generate static `sitemap.xml` files during `next build` or Remix production builds
|
|
177
|
+
- **Runtime**: Serve dynamically from an API route; regenerate on demand or on ISR revalidation
|
|
178
|
+
- **CI/CD**: Validate sitemap URL entries as part of pull request checks
|
|
179
|
+
|
|
180
|
+
**Data flow**
|
|
181
|
+
|
|
182
|
+
1. **Input**: Array of `SitemapURL` objects with `loc`, `lastmod`, optional images/videos/news
|
|
183
|
+
2. **Analysis**: Spec validation, namespace detection, XML serialization
|
|
184
|
+
3. **Output**: Valid XML string or `AsyncIterable<string>` stream
|
|
185
|
+
4. **Action**: Serve as `application/xml`, write to disk, or submit to GSC via `@power-seo/search-console`
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Features Comparison with Popular Packages
|
|
190
|
+
|
|
191
|
+
| Capability | next-sitemap | sitemap (npm) | xmlbuilder2 | @power-seo/sitemap |
|
|
192
|
+
| ------------------------- | -----------: | ------------: | ----------: | -----------------: |
|
|
193
|
+
| Image sitemap extension | ✅ | ✅ | ❌ | ✅ |
|
|
194
|
+
| Video sitemap extension | ❌ | ✅ | ❌ | ✅ |
|
|
195
|
+
| News sitemap extension | ❌ | ✅ | ❌ | ✅ |
|
|
196
|
+
| Streaming generation | ❌ | ❌ | ❌ | ✅ |
|
|
197
|
+
| Auto index splitting | ✅ | ❌ | ❌ | ✅ |
|
|
198
|
+
| URL validation | ❌ | ❌ | ❌ | ✅ |
|
|
199
|
+
| Zero runtime dependencies | ❌ | ❌ | ❌ | ✅ |
|
|
200
|
+
| Edge runtime compatible | ❌ | ❌ | ❌ | ✅ |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## @power-seo Ecosystem
|
|
205
|
+
|
|
206
|
+
All 17 packages are independently installable — use only what you need.
|
|
207
|
+
|
|
208
|
+
| Package | Install | Description |
|
|
209
|
+
| ------------------------------------------------------------------------------------------ | ----------------------------------- | ----------------------------------------------------------------------- |
|
|
210
|
+
| [`@power-seo/core`](https://www.npmjs.com/package/@power-seo/core) | `npm i @power-seo/core` | Framework-agnostic utilities, types, validators, and constants |
|
|
211
|
+
| [`@power-seo/react`](https://www.npmjs.com/package/@power-seo/react) | `npm i @power-seo/react` | React SEO components — meta, Open Graph, Twitter Card, breadcrumbs |
|
|
212
|
+
| [`@power-seo/meta`](https://www.npmjs.com/package/@power-seo/meta) | `npm i @power-seo/meta` | SSR meta helpers for Next.js App Router, Remix v2, and generic SSR |
|
|
213
|
+
| [`@power-seo/schema`](https://www.npmjs.com/package/@power-seo/schema) | `npm i @power-seo/schema` | Type-safe JSON-LD structured data — 20 builders + 18 React components |
|
|
214
|
+
| [`@power-seo/content-analysis`](https://www.npmjs.com/package/@power-seo/content-analysis) | `npm i @power-seo/content-analysis` | Yoast-style SEO content scoring engine with React components |
|
|
215
|
+
| [`@power-seo/readability`](https://www.npmjs.com/package/@power-seo/readability) | `npm i @power-seo/readability` | Readability scoring — Flesch-Kincaid, Gunning Fog, Coleman-Liau, ARI |
|
|
216
|
+
| [`@power-seo/preview`](https://www.npmjs.com/package/@power-seo/preview) | `npm i @power-seo/preview` | SERP, Open Graph, and Twitter/X Card preview generators |
|
|
217
|
+
| [`@power-seo/sitemap`](https://www.npmjs.com/package/@power-seo/sitemap) | `npm i @power-seo/sitemap` | XML sitemap generation, streaming, index splitting, and validation |
|
|
218
|
+
| [`@power-seo/redirects`](https://www.npmjs.com/package/@power-seo/redirects) | `npm i @power-seo/redirects` | Redirect engine with Next.js, Remix, and Express adapters |
|
|
219
|
+
| [`@power-seo/links`](https://www.npmjs.com/package/@power-seo/links) | `npm i @power-seo/links` | Link graph analysis — orphan detection, suggestions, equity scoring |
|
|
220
|
+
| [`@power-seo/audit`](https://www.npmjs.com/package/@power-seo/audit) | `npm i @power-seo/audit` | Full SEO audit engine — meta, content, structure, performance rules |
|
|
221
|
+
| [`@power-seo/images`](https://www.npmjs.com/package/@power-seo/images) | `npm i @power-seo/images` | Image SEO — alt text, lazy loading, format analysis, image sitemaps |
|
|
222
|
+
| [`@power-seo/ai`](https://www.npmjs.com/package/@power-seo/ai) | `npm i @power-seo/ai` | LLM-agnostic AI prompt templates and parsers for SEO tasks |
|
|
223
|
+
| [`@power-seo/analytics`](https://www.npmjs.com/package/@power-seo/analytics) | `npm i @power-seo/analytics` | Merge GSC + audit data, trend analysis, ranking insights, dashboard |
|
|
224
|
+
| [`@power-seo/search-console`](https://www.npmjs.com/package/@power-seo/search-console) | `npm i @power-seo/search-console` | Google Search Console API — OAuth2, service account, URL inspection |
|
|
225
|
+
| [`@power-seo/integrations`](https://www.npmjs.com/package/@power-seo/integrations) | `npm i @power-seo/integrations` | Semrush and Ahrefs API clients with rate limiting and pagination |
|
|
226
|
+
| [`@power-seo/tracking`](https://www.npmjs.com/package/@power-seo/tracking) | `npm i @power-seo/tracking` | GA4, Clarity, PostHog, Plausible, Fathom — scripts + consent management |
|
|
227
|
+
|
|
228
|
+
### Ecosystem vs alternatives
|
|
229
|
+
|
|
230
|
+
| Need | Common approach | @power-seo approach |
|
|
231
|
+
| ------------------ | ---------------------- | ---------------------------------------------------- |
|
|
232
|
+
| Sitemap generation | `next-sitemap` | `@power-seo/sitemap` — streaming, image, video, news |
|
|
233
|
+
| Sitemap submission | Manual GSC UI | `@power-seo/search-console` — `submitSitemap()` |
|
|
234
|
+
| Image SEO | Manual `<image:image>` | `@power-seo/sitemap` + `@power-seo/images` |
|
|
235
|
+
| Structured data | Manual JSON-LD | `@power-seo/schema` — typed builders |
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Enterprise Integration
|
|
240
|
+
|
|
241
|
+
**Multi-tenant SaaS**
|
|
242
|
+
|
|
243
|
+
- **Per-tenant sitemaps**: Generate separate sitemaps per client domain; serve from tenant-aware API routes
|
|
244
|
+
- **Sitemap index**: Use `generateSitemapIndex()` to aggregate tenant sitemaps into a root index
|
|
245
|
+
- **Scheduled regeneration**: Rebuild sitemaps nightly as new content is published
|
|
246
|
+
|
|
247
|
+
**ERP / internal portals**
|
|
248
|
+
|
|
249
|
+
- Generate sitemaps only for public-facing modules (knowledge base, product catalog)
|
|
250
|
+
- Use `validateSitemapUrl()` to enforce URL format standards across generated entries
|
|
251
|
+
- Pipe large catalogs through `streamSitemap()` to avoid memory limits in serverless environments
|
|
252
|
+
|
|
253
|
+
**Recommended integration pattern**
|
|
254
|
+
|
|
255
|
+
- Generate sitemaps in **CI** at build time for static content
|
|
256
|
+
- Serve dynamically from **API routes** for frequently updated content
|
|
257
|
+
- Submit new sitemaps to GSC via `@power-seo/search-console` after deployment
|
|
258
|
+
- Monitor crawl coverage in Google Search Console
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Scope and Limitations
|
|
263
|
+
|
|
264
|
+
**This package does**
|
|
265
|
+
|
|
266
|
+
- ✅ Generate spec-compliant XML sitemaps from URL arrays
|
|
267
|
+
- ✅ Support image, video, and news sitemap extensions
|
|
268
|
+
- ✅ Stream large sitemaps to avoid memory spikes
|
|
269
|
+
- ✅ Split sitemaps and generate sitemap index files
|
|
270
|
+
|
|
271
|
+
**This package does not**
|
|
272
|
+
|
|
273
|
+
- ❌ Crawl your site to discover URLs — you provide the URL list
|
|
274
|
+
- ❌ Submit sitemaps to Google — use `@power-seo/search-console` for submission
|
|
275
|
+
- ❌ Monitor sitemap status — use Google Search Console for crawl coverage reports
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## API Reference
|
|
280
|
+
|
|
281
|
+
### `generateSitemap(config)`
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
function generateSitemap(config: SitemapConfig): string;
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
| Prop | Type | Description |
|
|
288
|
+
| ------ | -------------- | -------------------- |
|
|
289
|
+
| `urls` | `SitemapURL[]` | Array of URL entries |
|
|
290
|
+
|
|
291
|
+
#### `SitemapURL`
|
|
292
|
+
|
|
293
|
+
| Prop | Type | Default | Description |
|
|
294
|
+
| ------------ | --------------------------------------------------------------------------------- | ------- | ---------------------------------------- |
|
|
295
|
+
| `loc` | `string` | — | **Required.** Absolute URL |
|
|
296
|
+
| `lastmod` | `string` | — | Last modified (ISO 8601 or `YYYY-MM-DD`) |
|
|
297
|
+
| `changefreq` | `'always' \| 'hourly' \| 'daily' \| 'weekly' \| 'monthly' \| 'yearly' \| 'never'` | — | Change frequency |
|
|
298
|
+
| `priority` | `number` | `0.5` | Priority 0.0–1.0 |
|
|
299
|
+
| `images` | `SitemapImage[]` | — | Image extension entries |
|
|
300
|
+
| `videos` | `SitemapVideo[]` | — | Video extension entries |
|
|
301
|
+
| `news` | `SitemapNews` | — | News extension entry |
|
|
302
|
+
|
|
303
|
+
### `streamSitemap(config)`
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
function streamSitemap(config: SitemapConfig): AsyncIterable<string>;
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Returns an async iterable that yields XML chunks. Suitable for piping to a Node.js `Writable`.
|
|
310
|
+
|
|
311
|
+
### `splitSitemap(urls, maxPerFile?)`
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
function splitSitemap(urls: SitemapURL[], maxPerFile?: number): SitemapURL[][];
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Splits `urls` into chunks of at most `maxPerFile` (default: `MAX_URLS_PER_SITEMAP` = 50,000).
|
|
318
|
+
|
|
319
|
+
### `generateSitemapIndex(config)`
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
function generateSitemapIndex(config: SitemapIndexConfig): string;
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
| Prop | Type | Description |
|
|
326
|
+
| ---------- | --------------------- | -------------------------------------------- |
|
|
327
|
+
| `sitemaps` | `SitemapIndexEntry[]` | Array of `{ loc: string; lastmod?: string }` |
|
|
328
|
+
|
|
329
|
+
### `validateSitemapUrl(url)`
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
function validateSitemapUrl(url: SitemapURL): SitemapValidationResult;
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Returns `{ valid: boolean; errors: string[]; warnings: string[] }`.
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Contributing
|
|
340
|
+
|
|
341
|
+
- Issues: [github.com/cybercraftbd/power-seo/issues](https://github.com/cybercraftbd/power-seo/issues)
|
|
342
|
+
- PRs: [github.com/cybercraftbd/power-seo/pulls](https://github.com/cybercraftbd/power-seo/pulls)
|
|
343
|
+
- Development setup:
|
|
344
|
+
1. `pnpm i`
|
|
345
|
+
2. `pnpm build`
|
|
346
|
+
3. `pnpm test`
|
|
347
|
+
|
|
348
|
+
**Release workflow**
|
|
349
|
+
|
|
350
|
+
- `npm version patch|minor|major`
|
|
351
|
+
- `npm publish --access public`
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## About CyberCraft Bangladesh
|
|
356
|
+
|
|
357
|
+
**CyberCraft Bangladesh** is a Bangladesh-based enterprise-grade software engineering company specializing in ERP system development, AI-powered SaaS and business applications, full-stack SEO services, custom website development, and scalable eCommerce platforms. We design and develop intelligent, automation-driven SaaS and enterprise solutions that help startups, SMEs, NGOs, educational institutes, and large organizations streamline operations, enhance digital visibility, and accelerate growth through modern cloud-native technologies.
|
|
358
|
+
|
|
359
|
+
| | |
|
|
360
|
+
| -------------------- | -------------------------------------------------------------- |
|
|
361
|
+
| **Website** | [ccbd.dev](https://ccbd.dev) |
|
|
362
|
+
| **GitHub** | [github.com/cybercraftbd](https://github.com/cybercraftbd) |
|
|
363
|
+
| **npm Organization** | [npmjs.com/org/power-seo](https://www.npmjs.com/org/power-seo) |
|
|
364
|
+
| **Email** | [info@ccbd.dev](mailto:info@ccbd.dev) |
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## License
|
|
369
|
+
|
|
370
|
+
**MIT**
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Keywords
|
|
375
|
+
|
|
376
|
+
```text
|
|
377
|
+
seo, sitemap, xml-sitemap, sitemap-generator, image-sitemap, video-sitemap, news-sitemap, sitemap-index, typescript, nextjs, remix, streaming, crawl-budget, google-indexing
|
|
378
|
+
```
|