pagesight 0.5.1 → 0.5.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/package.json +1 -1
- package/src/tools/metatags.ts +27 -5
package/package.json
CHANGED
package/src/tools/metatags.ts
CHANGED
|
@@ -322,11 +322,15 @@ export function registerMetatagsTool(server: McpServer): void {
|
|
|
322
322
|
// Redirect chain (only if there were redirects)
|
|
323
323
|
if (chain.length > 1) {
|
|
324
324
|
output.push("--- Redirect Chain ---", "");
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
325
|
+
const parts: string[] = [];
|
|
326
|
+
for (const hop of chain) {
|
|
327
|
+
parts.push(hop.url);
|
|
328
|
+
parts.push(String(hop.status));
|
|
329
329
|
}
|
|
330
|
+
// Format: URL → status → URL → status (drop trailing status)
|
|
331
|
+
parts.pop();
|
|
332
|
+
output.push(parts.join(" → "));
|
|
333
|
+
output.push(`Hops: ${chain.length - 1}`);
|
|
330
334
|
output.push("");
|
|
331
335
|
}
|
|
332
336
|
|
|
@@ -352,9 +356,27 @@ export function registerMetatagsTool(server: McpServer): void {
|
|
|
352
356
|
output.push(`${check.tag}: BROKEN — HTTP ${check.status}`);
|
|
353
357
|
output.push(` URL: ${check.url}`);
|
|
354
358
|
} else {
|
|
355
|
-
const
|
|
359
|
+
const sizeKB = check.contentLength ? Math.round(check.contentLength / 1024) : null;
|
|
360
|
+
const size = sizeKB ? ` (${sizeKB} KB)` : "";
|
|
356
361
|
const type = check.contentType ? ` ${check.contentType}` : "";
|
|
357
362
|
output.push(`${check.tag}: OK —${type}${size}`);
|
|
363
|
+
if (sizeKB && sizeKB > 1024) {
|
|
364
|
+
output.push(` Warning: ${sizeKB} KB is large for social previews — consider compressing below 1 MB`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Check declared dimensions from meta tags
|
|
369
|
+
if (check.tag === "og:image") {
|
|
370
|
+
const w = getMeta(parsed.meta, "og:image:width");
|
|
371
|
+
const h = getMeta(parsed.meta, "og:image:height");
|
|
372
|
+
if (w && h) {
|
|
373
|
+
output.push(` Declared dimensions: ${w}x${h}`);
|
|
374
|
+
const wn = Number(w);
|
|
375
|
+
const hn = Number(h);
|
|
376
|
+
if (wn && hn && (wn < 1200 || hn < 630)) {
|
|
377
|
+
output.push(` Note: recommended minimum for og:image is 1200x630`);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
358
380
|
}
|
|
359
381
|
}
|
|
360
382
|
}
|