@operstack/audit 0.3.2 → 0.3.3
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/collect.mjs +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operstack/audit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "SEO, AEO and GEO audit generator: collect public signals from a site into audit.json, let an analyst or an agent fill the narrative, render the OperStack report as HTML and PDF.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/collect.mjs
CHANGED
|
@@ -68,7 +68,7 @@ function analysePage(url, html) {
|
|
|
68
68
|
// Conversion path, read from the page itself. No analytics is needed to see whether a visitor
|
|
69
69
|
// who wants to talk to this business can find a way to do it, and how far down it is.
|
|
70
70
|
const bodyInner = body?.innerHTML || html;
|
|
71
|
-
const CONTACT_INTENT = /contact|enquir|inquir|get in touch|request a|book a|call us|consult|get a quote|free quote
|
|
71
|
+
const CONTACT_INTENT = /contact|enquir|inquir|get in touch|request a|book a|call us|consult|get a quote|free quote|order (the|an|a|your)|buy |get started|start (here|free|now)|try it|check (your|a) site|audit|pricing|связ|заяв|консульт|оставить|закаж|закажите|купить|узнать цен|проверить сайт|начать/i;
|
|
72
72
|
const hrefsLower = links.map((h) => h.toLowerCase());
|
|
73
73
|
const telLinks = hrefsLower.filter((h) => h.startsWith('tel:')).length;
|
|
74
74
|
const mailLinks = hrefsLower.filter((h) => h.startsWith('mailto:')).length;
|
|
@@ -212,7 +212,13 @@ export async function collect(startUrl, { pages = 20, log = () => {}, backlinks
|
|
|
212
212
|
log(`sampling up to ${pages} pages`);
|
|
213
213
|
const norm = (u) => { try { const x = new URL(u); x.hash = ''; x.search = ''; if (!x.pathname.includes('.') && !x.pathname.endsWith('/')) x.pathname += '/'; return x.href.toLowerCase(); } catch { return u; } };
|
|
214
214
|
const seenUrl = new Set([norm(home.final), norm(startUrl)]);
|
|
215
|
-
const
|
|
215
|
+
const rest = sitemapPages.filter((u) => { const n = norm(u); if (seenUrl.has(n)) return false; seenUrl.add(n); return true; });
|
|
216
|
+
// The contact, about and policy pages are what the trust and conversion checks are about, so they
|
|
217
|
+
// are read first rather than left to the luck of sitemap order. A 44 page site sampled 20 deep was
|
|
218
|
+
// reporting "no messenger and no contact page" while both sat in the sitemap, unread.
|
|
219
|
+
const TRUST_PAGE = /\/(contact|contacts|contact-us|kontakt|kontakty|about|about-us|o-nas|team|company|privacy|privacy-policy|politika[a-z-]*|terms|terms-of-use|usloviya|oferta|legal|impressum)\/?$/i;
|
|
220
|
+
const trustFirst = rest.filter((u) => { try { return TRUST_PAGE.test(new URL(u).pathname); } catch { return false; } });
|
|
221
|
+
const pool = [home.final, ...trustFirst, ...rest.filter((u) => !trustFirst.includes(u))];
|
|
216
222
|
const sample = [];
|
|
217
223
|
for (const u of pool.slice(0, pages)) {
|
|
218
224
|
const r = await get(u);
|