@escape-game-over/atlas 0.1.32 → 0.1.33
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 +1 -1
- package/src/index.ts +1 -0
- package/src/meta/index.ts +5 -1
- package/src/meta/share-image.ts +6 -3
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/meta/index.ts
CHANGED
|
@@ -57,7 +57,11 @@ export type {
|
|
|
57
57
|
ThemeColor,
|
|
58
58
|
} from "./content.ts";
|
|
59
59
|
export type { RobotsDirective, RobotsPolicy } from "./robots.ts";
|
|
60
|
-
export {
|
|
60
|
+
export {
|
|
61
|
+
META_LENGTH_LIMITS,
|
|
62
|
+
resolveShareImage,
|
|
63
|
+
type ShareImage,
|
|
64
|
+
} from "./share-image.ts";
|
|
61
65
|
export type { MetaTag } from "./tag.ts";
|
|
62
66
|
export type { SiteVerification } from "./verification.ts";
|
|
63
67
|
|
package/src/meta/share-image.ts
CHANGED
|
@@ -109,8 +109,11 @@ const NO_PREVIEW_BELOW = 200;
|
|
|
109
109
|
* the tightest is the one that counts. Facebook's mobile preview is that: a line
|
|
110
110
|
* under it survives everywhere, while a line written to Google's 160 is already
|
|
111
111
|
* clipped in a share. A title is cut far sooner, by the surface people search on.
|
|
112
|
+
*
|
|
113
|
+
* Exported so a site that picks between copy variants fits them to these
|
|
114
|
+
* numbers rather than a copy of them.
|
|
112
115
|
*/
|
|
113
|
-
const
|
|
116
|
+
export const META_LENGTH_LIMITS = {
|
|
114
117
|
title: {
|
|
115
118
|
limit: 60,
|
|
116
119
|
why: "a search result cuts a title around there, and the end of it is usually the part that identifies the page",
|
|
@@ -128,11 +131,11 @@ const LENGTH_LIMITS = {
|
|
|
128
131
|
* nobody notices without being told.
|
|
129
132
|
*/
|
|
130
133
|
export function warnIfClipped(
|
|
131
|
-
field: keyof typeof
|
|
134
|
+
field: keyof typeof META_LENGTH_LIMITS,
|
|
132
135
|
value: string,
|
|
133
136
|
at: string
|
|
134
137
|
): void {
|
|
135
|
-
const { limit, why } =
|
|
138
|
+
const { limit, why } = META_LENGTH_LIMITS[field];
|
|
136
139
|
if (value.length <= limit) return;
|
|
137
140
|
|
|
138
141
|
warn(at, `${field} is ${value.length} characters, past ~${limit}: ${why}.`);
|