@ultimat3/seo 31.6.0 → 31.7.0
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/CLAUDE.md +2 -1
- package/README.md +3 -1
- package/package.json +3 -3
- package/src/sitemap.ts +13 -3
package/CLAUDE.md
CHANGED
|
@@ -52,7 +52,8 @@ Tier 1. May import `@ultimat3/core`, `@ultimat3/schema`, `@ultimat3/i18n`. Nothi
|
|
|
52
52
|
- **A page's `lastmod` never reads the ambient zone, and a future one is clamped.**
|
|
53
53
|
`sitemapDatetime` refuses a zoneless time before `Date.parse` can read it in the process's zone.
|
|
54
54
|
Refusing a future date would fail a whole enumeration for one skewed row; clamping to `now` is
|
|
55
|
-
the true upper bound.
|
|
55
|
+
the true upper bound. "Now" is `BuildSitemapOptions.clock`, read once per build — the feed's
|
|
56
|
+
seam; `now: Date` is a deprecated alias until the next major. A route's `lastmod` string is the caller's and is written as given.
|
|
56
57
|
- **The hreflang cluster, `x-default` and the `<loc>`s read ONE trimmed list** — the page's
|
|
57
58
|
`locales`, minus what `disallow` blocks. Never trim one of the three alone.
|
|
58
59
|
- **Errors name the file, not the URL.** `RouteRecord.file` is in every cause and every fix; an agent must be able to open the source without guessing.
|
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ derived. One opt-in, declared by the route:
|
|
|
92
92
|
## Sitemap: pages, sections, caps
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
|
+
import { frozenClock } from '@ultimat3/core';
|
|
95
96
|
import { buildSitemap, type RouteRecord } from '@ultimat3/seo';
|
|
96
97
|
|
|
97
98
|
declare const routes: readonly RouteRecord[];
|
|
@@ -103,6 +104,7 @@ await buildSitemap(routes, {
|
|
|
103
104
|
maxUrls: 1000, // page size; default 50,000
|
|
104
105
|
sections: [{ name: 'blog', match: '/blog/**' }], // omitted: one urlset
|
|
105
106
|
disallow: ['/panel'], // robots.txt rules: never listed
|
|
107
|
+
clock: frozenClock('2026-10-11T00:00:00Z'), // "now", read once; default systemClock
|
|
106
108
|
});
|
|
107
109
|
// → index /sitemap.xml · files /sitemaps/pages-1.xml, /sitemaps/blog-1.xml, /sitemaps/blog-2.xml …
|
|
108
110
|
```
|
|
@@ -110,7 +112,7 @@ await buildSitemap(routes, {
|
|
|
110
112
|
| Rule | |
|
|
111
113
|
|---|---|
|
|
112
114
|
| a page | `RouteRecord.prerender()` answers `'/blog/a'` or a `SitemapPage` — `{ path, lastmod?, locales? }`. `expandRoutePages()` reads both; `expandRoute()` still answers paths |
|
|
113
|
-
| `lastmod` | a `Date` or ISO 8601 with a zone, written in UTC. No zone, or no date: `X_SITEMAP_ENTRY_INVALID`. After `now
|
|
115
|
+
| `lastmod` | a `Date` or ISO 8601 with a zone, written in UTC. No zone, or no date: `X_SITEMAP_ENTRY_INVALID`. After `clock.now()` (read once per build, `systemClock` by default — the feed's seam; `now: Date` is a deprecated alias): clamped to it — one row from a clock a second ahead must not fail every page, and a future date is one a crawler stops believing |
|
|
114
116
|
| `locales` | per page, else `RouteRecord.locales`, else all. One `<url>` per listed locale, hreflang among those only; `x-default` only when the default is listed; a page left in one locale of several carries no alternates; `[]` lists it nowhere. An unknown name is `X_SITEMAP_ENTRY_INVALID` |
|
|
115
117
|
| sections | matched on the unprefixed path, so a page and its locale copies share a file. `pages` (reserved) first, then declaration order; inside one, sorted by path. Numbered from 1; an empty one writes nothing; the index `<lastmod>` of a child is the newest inside it (`SitemapFile.lastmod`) |
|
|
116
118
|
| no sections | byte-for-byte the output before sections existed — `sitemap-sections.test.ts` pins the hash |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/seo",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.7.0",
|
|
4
4
|
"description": "Enforced SEO: typed meta, JSON-LD, sitemap, robots, feeds, responsive images, perf budgets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"test": "bun test"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@ultimat3/core": "31.
|
|
47
|
-
"@ultimat3/schema": "31.
|
|
46
|
+
"@ultimat3/core": "31.7.0",
|
|
47
|
+
"@ultimat3/schema": "31.7.0"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/sitemap.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// enumerates, so the sitemap can never drift from what the build actually produced. One urlset —
|
|
3
3
|
// split into an index past a protocol cap — or, with `sections`, an index of named, paginated parts.
|
|
4
4
|
|
|
5
|
-
import { assert, SITEMAP_DEFAULT_SECTION } from '@ultimat3/core';
|
|
5
|
+
import { assert, type Clock, SITEMAP_DEFAULT_SECTION, systemClock } from '@ultimat3/core';
|
|
6
6
|
import { sitemapEntryInvalid, sitemapTooLarge } from './errors';
|
|
7
7
|
import { hreflangTag } from './locale-tags';
|
|
8
8
|
import { disallowMatcher } from './robots';
|
|
@@ -76,7 +76,16 @@ export interface BuildSitemapOptions {
|
|
|
76
76
|
* hreflang cluster: a crawler told to stay out of a URL must not be handed it to fetch.
|
|
77
77
|
*/
|
|
78
78
|
disallow?: readonly string[];
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Where "now" comes from — the moment a page's `lastmod` may not be later than. Read once per
|
|
81
|
+
* build. Defaults to `systemClock`; pass `frozenClock(at)` for a reproducible sitemap. The same
|
|
82
|
+
* seam as `BuildFeedOptions.clock`.
|
|
83
|
+
*/
|
|
84
|
+
clock?: Clock;
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated Pass `clock: frozenClock(now)`. A second clock seam beside `clock`, kept as an
|
|
87
|
+
* alias until the next major; `clock` wins when both are given.
|
|
88
|
+
*/
|
|
80
89
|
now?: Date;
|
|
81
90
|
}
|
|
82
91
|
|
|
@@ -158,7 +167,8 @@ async function sitemapClusters(
|
|
|
158
167
|
const clusters: Cluster[] = [];
|
|
159
168
|
const locales = options.locales ?? [];
|
|
160
169
|
const disallowed = disallowMatcher(options.disallow ?? []);
|
|
161
|
-
|
|
170
|
+
// Read ONCE: every page of one build is clamped to the same instant.
|
|
171
|
+
const now = options.clock?.now() ?? options.now ?? systemClock.now();
|
|
162
172
|
|
|
163
173
|
for (const route of indexableRoutes(routes)) {
|
|
164
174
|
for (const page of await expandRoutePages(route)) {
|