@ultimat3/seo 19.1.3 → 19.3.1
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/package.json +3 -2
- package/src/validate.ts +12 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/seo",
|
|
3
|
-
"version": "19.1
|
|
3
|
+
"version": "19.3.1",
|
|
4
4
|
"description": "Enforced SEO: typed meta, JSON-LD, sitemap, robots, feeds, responsive images, perf budgets",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"test": "bun test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ultimat3/core": "19.1
|
|
34
|
+
"@ultimat3/core": "19.3.1",
|
|
35
|
+
"@ultimat3/schema": "19.3.1"
|
|
35
36
|
}
|
|
36
37
|
}
|
package/src/validate.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// duplicate meta, an over-length title, and a canonical that lies.
|
|
5
5
|
|
|
6
6
|
import { finiteCount } from '@ultimat3/core';
|
|
7
|
+
import { charCount } from '@ultimat3/schema';
|
|
7
8
|
import {
|
|
8
9
|
canonicalMismatch,
|
|
9
10
|
duplicateMeta,
|
|
@@ -91,10 +92,16 @@ export function validateMeta(
|
|
|
91
92
|
);
|
|
92
93
|
}
|
|
93
94
|
const rendered = applyTitleTemplate(meta.title, meta.titleTemplate);
|
|
94
|
-
|
|
95
|
+
// `charCount`, never `.length`: the framework counts a length in CODE POINTS — the unit
|
|
96
|
+
// JSON Schema's `maxLength` means, the unit every "N characters" message here says, and the
|
|
97
|
+
// unit Postgres' `char_length` counts. `'👍'.length` is 2, so a title one emoji short of the
|
|
98
|
+
// ceiling was refused as over it and the cause quoted a number nobody can reproduce by
|
|
99
|
+
// counting. One statement of the unit, in `@ultimat3/schema`, read here.
|
|
100
|
+
const renderedLength = charCount(rendered);
|
|
101
|
+
if (renderedLength > titleMax) {
|
|
95
102
|
issues.push(
|
|
96
103
|
issueOf(
|
|
97
|
-
metaTooLong(route.file, 'title',
|
|
104
|
+
metaTooLong(route.file, 'title', renderedLength, titleMax),
|
|
98
105
|
route.path,
|
|
99
106
|
route.file,
|
|
100
107
|
),
|
|
@@ -108,10 +115,11 @@ export function validateMeta(
|
|
|
108
115
|
issueOf(metaMissing(route.file, route.path, 'description'), route.path, route.file),
|
|
109
116
|
);
|
|
110
117
|
} else {
|
|
111
|
-
|
|
118
|
+
const descriptionLength = charCount(meta.description);
|
|
119
|
+
if (descriptionLength > descriptionMax) {
|
|
112
120
|
issues.push(
|
|
113
121
|
issueOf(
|
|
114
|
-
metaTooLong(route.file, 'description',
|
|
122
|
+
metaTooLong(route.file, 'description', descriptionLength, descriptionMax),
|
|
115
123
|
route.path,
|
|
116
124
|
route.file,
|
|
117
125
|
),
|