search-visibility 1.2.0 → 1.3.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/CHANGELOG.md +43 -0
- package/README.es.md +39 -3
- package/README.ja.md +39 -3
- package/README.ko.md +47 -10
- package/README.md +47 -10
- package/README.zh.md +39 -3
- package/package.json +2 -1
- package/skills/seo-orchestrator/scripts/ai-performance.mjs +107 -0
- package/skills/seo-orchestrator/scripts/canonical.mjs +175 -0
- package/skills/seo-orchestrator/scripts/command.mjs +6 -0
- package/skills/seo-orchestrator/scripts/comparison-pairs.mjs +89 -0
- package/skills/seo-orchestrator/scripts/crawl-report.mjs +34 -0
- package/skills/seo-orchestrator/scripts/fetch-page.mjs +2 -5
- package/skills/seo-orchestrator/scripts/hreflang.mjs +273 -0
- package/skills/seo-orchestrator/scripts/html.mjs +7 -80
- package/skills/seo-orchestrator/scripts/index-status.mjs +181 -0
- package/skills/seo-orchestrator/scripts/indexing.mjs +28 -39
- package/skills/seo-orchestrator/scripts/internal-crawl.mjs +16 -46
- package/skills/seo-orchestrator/scripts/link-header.mjs +93 -0
- package/skills/seo-orchestrator/scripts/mcp.mjs +45 -8
- package/skills/seo-orchestrator/scripts/naver-advisor.mjs +147 -0
- package/skills/seo-orchestrator/scripts/observations.mjs +42 -8
- package/skills/seo-orchestrator/scripts/report-html.mjs +35 -0
- package/skills/seo-orchestrator/scripts/report-input.mjs +142 -0
- package/skills/seo-orchestrator/scripts/report-sources.mjs +202 -0
- package/skills/seo-orchestrator/scripts/robots.mjs +270 -0
- package/skills/seo-orchestrator/scripts/scope.mjs +185 -0
- package/skills/seo-orchestrator/scripts/search-performance.mjs +1 -1
- package/skills/seo-orchestrator/scripts/seo-check.mjs +203 -263
- package/skills/seo-orchestrator/scripts/site-audit.mjs +102 -46
- package/skills/seo-orchestrator/scripts/structured-data.mjs +316 -0
- package/skills/seo-orchestrator/scripts/url-inspection.mjs +150 -0
- package/skills/seo-orchestrator/scripts/visibility-comparison.mjs +218 -39
- package/skills/seo-orchestrator/scripts/visibility-report.mjs +71 -48
- package/skills/seo-orchestrator/scripts/visibility.mjs +53 -50
|
@@ -9,10 +9,18 @@ import { readFile } from "node:fs/promises";
|
|
|
9
9
|
import { parseArgs } from "node:util";
|
|
10
10
|
import { isCliEntry } from "./cli-entry.mjs";
|
|
11
11
|
|
|
12
|
-
import { parseHtml, checkCanonical, httpUrl } from "./html.mjs";
|
|
12
|
+
import { parseHtml, checkCanonical, canonicalDeclarations, httpUrl } from "./html.mjs";
|
|
13
13
|
import { auditLlms } from "./llms-audit.mjs";
|
|
14
14
|
import { fetchPage, fetchResource } from "./fetch-page.mjs";
|
|
15
15
|
import { indexingRules, reportIndexing } from "./indexing.mjs";
|
|
16
|
+
import { describeBlock, describeCrawlBlock, describeIndexing, indexingStatus, normalizeIntent, unreadableExclusions } from "./index-status.mjs";
|
|
17
|
+
import { analyzeJsonLd, describeBlockResult, describeCheck, describeOmittedBlocks, pageFindings } from "./structured-data.mjs";
|
|
18
|
+
import {
|
|
19
|
+
decideRobotsPath, describeRobotsFetch, describeRobotsHandling, evaluateRobots, normalizeRobotsPath,
|
|
20
|
+
parseRobots, readRobots, robotsEngine, robotsPathFor, CRAWLERS,
|
|
21
|
+
} from "./robots.mjs";
|
|
22
|
+
import { comparableUrl, parseLinkHeader } from "./link-header.mjs";
|
|
23
|
+
import { analyzeHreflang, describeHreflang, keptDeclarations, pageDeclarations, usable } from "./hreflang.mjs";
|
|
16
24
|
|
|
17
25
|
export { parseHtml };
|
|
18
26
|
|
|
@@ -20,68 +28,35 @@ export const UA = "seo-skills-check/0.1 (+https://github.com/shaul1991/search-vi
|
|
|
20
28
|
|
|
21
29
|
// ---------- JSON-LD ----------
|
|
22
30
|
|
|
23
|
-
function flattenLd(node, out = []) {
|
|
24
|
-
if (Array.isArray(node)) node.forEach((n) => flattenLd(n, out));
|
|
25
|
-
else if (node && typeof node === "object") {
|
|
26
|
-
if (node["@graph"]) flattenLd(node["@graph"], out);
|
|
27
|
-
if (node["@type"]) out.push(node);
|
|
28
|
-
}
|
|
29
|
-
return out;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const typesOf = (n) => [].concat(n["@type"] || []).map(String);
|
|
33
|
-
|
|
34
|
-
function checkDate(value, field, add) {
|
|
35
|
-
if (typeof value !== "string") return add("FAIL", t("구조화 데이터", "Structured data"), `Event.${field}`, (currentLocale() === "en" ? `${field} must be a string` : `${field}가 문자열이 아님`), "structured-data");
|
|
36
|
-
if (!/^\d{4}-\d{2}-\d{2}/.test(value)) return add("FAIL", t("구조화 데이터", "Structured data"), `Event.${field}`, (currentLocale() === "en" ? `Invalid ISO 8601 value: ${value}` : `ISO-8601 아님: ${value}`), "structured-data");
|
|
37
|
-
if (/T00:00(:00)?/.test(value)) add("WARN", t("구조화 데이터", "Structured data"), `Event.${field}`, (currentLocale() === "en" ? `Midnight placeholder (T00:00): ${value}. Use only the date when the time is unknown` : `자정(T00:00)으로 채운 값: ${value}. 시간을 모르면 날짜만 쓰기`), "structured-data");
|
|
38
|
-
else if (/T\d{2}:\d{2}/.test(value) && !/(Z|[+-]\d{2}:?\d{2})$/.test(value)) add("WARN", t("구조화 데이터", "Structured data"), `Event.${field}`, (currentLocale() === "en" ? `Missing UTC offset: ${value} (example: +09:00)` : `시간에 UTC 오프셋 없음: ${value} (예: +09:00)`), "structured-data");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
31
|
export function checkJsonLd(blocks, add) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
const channel = () => t("구조화 데이터", "Structured data");
|
|
33
|
+
const report = (level, item, detail) => add(level, channel(), item, detail, "structured-data");
|
|
34
|
+
const failures = [];
|
|
35
|
+
const grouped = new WeakMap();
|
|
36
|
+
const analysis = analyzeJsonLd(blocks, (check, node) => {
|
|
37
|
+
// 연관채널 속성은 노드마다 한 줄로 묶어 보고한다.
|
|
38
|
+
if (check.code === "channel") {
|
|
39
|
+
const seen = grouped.get(node) ?? new Set();
|
|
40
|
+
if (seen.has(check.feature)) return;
|
|
41
|
+
grouped.set(node, seen.add(check.feature));
|
|
42
|
+
}
|
|
43
|
+
failures.push(check);
|
|
44
|
+
}, (block) => {
|
|
45
|
+
// 문법 오류와 타입 없는 블록은 상세 목록의 상한과 관계없이 모두 보고한다.
|
|
46
|
+
if (block.state === "syntax-error") report("FAIL", `JSON-LD #${block.index}`, (currentLocale() === "en" ? `Invalid JSON: ${block.error}` : `JSON 파싱 실패: ${block.error}`));
|
|
47
|
+
else if (block.state === "no-type") report("WARN", `JSON-LD #${block.index}`, describeBlockResult(block, currentLocale()));
|
|
46
48
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
const [missing, ...eventFindings] = blocks.length ? [null, ...pageFindings(analysis, blocks.length, currentLocale())] : pageFindings(analysis, 0, currentLocale());
|
|
50
|
+
if (missing) report(missing.level, missing.item, missing.detail);
|
|
51
|
+
else report("INFO", t("유형", "Types"), analysis.types.join(", ") || t("(@type 없음)", "(No @type)"));
|
|
49
52
|
|
|
50
|
-
for (const
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
if (!n.name) add("FAIL", t("구조화 데이터", "Structured data"), "Event.name", t("필수 속성 없음", "Required property missing"), "structured-data");
|
|
54
|
-
if (!n.startDate) add("FAIL", t("구조화 데이터", "Structured data"), "Event.startDate", t("필수 속성 없음", "Required property missing"), "structured-data");
|
|
55
|
-
else checkDate(n.startDate, "startDate", add);
|
|
56
|
-
if (n.endDate) checkDate(n.endDate, "endDate", add);
|
|
57
|
-
const loc = [].concat(n.location || [])[0];
|
|
58
|
-
if (!loc) add("FAIL", t("구조화 데이터", "Structured data"), "Event.location", t("필수 속성 없음", "Required property missing"), "structured-data");
|
|
59
|
-
else {
|
|
60
|
-
if (!loc.name) add("WARN", t("구조화 데이터", "Structured data"), "Event.location.name", t("장소 이름 없음", "Missing venue name"), "structured-data");
|
|
61
|
-
if (!loc.address) add("FAIL", t("구조화 데이터", "Structured data"), "Event.location.address", t("주소 없음(Google 필수)", "Missing address (required by Google)"), "structured-data");
|
|
62
|
-
}
|
|
63
|
-
if (n.name && loc?.name && String(n.name).trim() === String(loc.name).trim()) add("WARN", t("구조화 데이터", "Structured data"), "Event.name", t("행사명이 장소명과 같음", "Event name matches the venue name"), "structured-data");
|
|
64
|
-
if (!n.eventStatus) add("INFO", t("구조화 데이터", "Structured data"), "Event.eventStatus", t("없음 → Google은 EventScheduled로 간주", "Missing. Google assumes EventScheduled"), "structured-data");
|
|
65
|
-
if (!n.image) add("WARN", t("구조화 데이터", "Structured data"), "Event.image", t("권장 속성 없음", "Recommended property missing"), "structured-data");
|
|
66
|
-
}
|
|
67
|
-
if (types.includes("BreadcrumbList")) {
|
|
68
|
-
const items = [].concat(n.itemListElement || []);
|
|
69
|
-
if (!items.length) add("FAIL", t("구조화 데이터", "Structured data"), "BreadcrumbList", t("itemListElement 없음", "Missing itemListElement"), "structured-data");
|
|
70
|
-
for (const it of items) {
|
|
71
|
-
const name = it.name ?? it.item?.name;
|
|
72
|
-
if (!name) add("FAIL", t("구조화 데이터", "Structured data"), "BreadcrumbList.name", t("name 없음(네이버 필수)", "Missing name (required by Naver)"), "structured-data");
|
|
73
|
-
else if (/^(홈|home|top)$/i.test(String(name).trim())) add("WARN", t("구조화 데이터", "Structured data"), "BreadcrumbList.name", (currentLocale() === "en" ? `Generic name "${name}". Naver recommends a name that describes the page` : `일반어 "${name}" — 네이버는 페이지를 설명하는 이름 권장`), "structured-data");
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if ((types.includes("Organization") || types.includes("Person")) && n.sameAs !== undefined) {
|
|
77
|
-
if (!n.name || !n.url) add("WARN", t("구조화 데이터", "Structured data"), `${types[0]}.sameAs`, t("네이버 연관채널은 name·url·sameAs 필수", "Naver associated channels require name, url and sameAs"), "structured-data");
|
|
78
|
-
}
|
|
79
|
-
if (types.includes("WebSite") && !n.name) add("WARN", t("구조화 데이터", "Structured data"), "WebSite.name", t("사이트 이름 없음", "Missing site name"), "structured-data");
|
|
53
|
+
for (const check of failures) report(check.level, check.code === "channel" ? check.feature : check.property, describeCheck(check, currentLocale()));
|
|
54
|
+
for (const block of analysis.blocks) {
|
|
55
|
+
if (block.nodeCount) report("INFO", `${t("JSON-LD 검사 범위", "JSON-LD coverage")} #${block.index}`, describeBlockResult(block, currentLocale()));
|
|
80
56
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return nodes;
|
|
57
|
+
if (analysis.omittedBlocks) report("INFO", t("JSON-LD 검사 범위", "JSON-LD coverage"), describeOmittedBlocks(analysis.omittedBlocks, currentLocale()));
|
|
58
|
+
for (const finding of eventFindings) report(finding.level, finding.item, finding.detail);
|
|
59
|
+
return analysis;
|
|
85
60
|
}
|
|
86
61
|
|
|
87
62
|
// ---------- 이미지 크기 ----------
|
|
@@ -111,100 +86,14 @@ export function imageSize(buf) {
|
|
|
111
86
|
|
|
112
87
|
// ---------- robots.txt ----------
|
|
113
88
|
|
|
114
|
-
function robotsGroups(txt) {
|
|
115
|
-
const groups = [];
|
|
116
|
-
let cur = null;
|
|
117
|
-
for (const raw of txt.split(/\r?\n/)) {
|
|
118
|
-
const line = raw.replace(/#.*/, "").trim();
|
|
119
|
-
const m = line.match(/^([a-zA-Z-]+)\s*:\s*(.*)$/);
|
|
120
|
-
if (!m) continue;
|
|
121
|
-
const [, k, v] = m;
|
|
122
|
-
const key = k.toLowerCase();
|
|
123
|
-
if (key === "user-agent") {
|
|
124
|
-
if (!cur || cur.rules.length) { cur = { agents: [], rules: [] }; groups.push(cur); }
|
|
125
|
-
cur.agents.push(v.toLowerCase());
|
|
126
|
-
} else if ((key === "allow" || key === "disallow") && cur) cur.rules.push({ type: key, path: v });
|
|
127
|
-
}
|
|
128
|
-
return groups;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// RFC 9309: 비 ASCII는 UTF-8 퍼센트 인코딩으로, 인코딩된 비예약 ASCII는 원래 문자로 비교한다.
|
|
132
|
-
// %2F 같은 예약 문자는 /와 다르며, 유니코드 경로의 대소문자도 보존한다.
|
|
133
|
-
function normalizeRobotsPath(path) {
|
|
134
|
-
return path.replace(/%[\da-f]{2}|[^\x21-\x7e]/giu, (part) => {
|
|
135
|
-
if (!part.startsWith("%")) return encodeURIComponent(part);
|
|
136
|
-
const char = String.fromCharCode(parseInt(part.slice(1), 16));
|
|
137
|
-
return /[a-zA-Z0-9._~-]/.test(char) ? char : part.toUpperCase();
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// 앞에서부터 일치시키고, * 사이의 리터럴은 순서대로 찾는다. 마지막 $는 쿼리를 포함한 URL 끝을 뜻한다.
|
|
142
|
-
function matchesRobotsPath(pattern, path) {
|
|
143
|
-
const exact = pattern.endsWith("$");
|
|
144
|
-
const pieces = (exact ? pattern.slice(0, -1) : pattern).split("*");
|
|
145
|
-
const first = pieces.shift();
|
|
146
|
-
if (!path.startsWith(first)) return false;
|
|
147
|
-
if (!pieces.length) return !exact || path.length === first.length;
|
|
148
|
-
|
|
149
|
-
const last = exact ? pieces.pop() : "";
|
|
150
|
-
if (!path.endsWith(last)) return false;
|
|
151
|
-
let cursor = first.length;
|
|
152
|
-
for (const piece of pieces) {
|
|
153
|
-
const found = path.indexOf(piece, cursor);
|
|
154
|
-
if (found < 0) return false;
|
|
155
|
-
cursor = found + piece.length;
|
|
156
|
-
}
|
|
157
|
-
return cursor <= path.length - last.length;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function matchingGroupName(groups, agent) {
|
|
161
|
-
let best = "";
|
|
162
|
-
for (const group of groups) {
|
|
163
|
-
for (const name of group.agents) {
|
|
164
|
-
if (name !== "*" && name.length > best.length && agent.startsWith(name)) best = name;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return best;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function decideRobotsPath(groups, agent, path) {
|
|
171
|
-
const name = agent.toLowerCase();
|
|
172
|
-
let groupName = matchingGroupName(groups, name);
|
|
173
|
-
let via = "own";
|
|
174
|
-
if (!groupName && name === "applebot") {
|
|
175
|
-
groupName = matchingGroupName(groups, "googlebot");
|
|
176
|
-
via = "fallback";
|
|
177
|
-
}
|
|
178
|
-
if (!groupName) {
|
|
179
|
-
groupName = "*";
|
|
180
|
-
via = groups.some((g) => g.agents.includes("*")) ? "*" : null;
|
|
181
|
-
}
|
|
182
|
-
let rule = null;
|
|
183
|
-
let bestLength = -1;
|
|
184
|
-
for (const group of groups) {
|
|
185
|
-
if (!group.agents.includes(groupName)) continue;
|
|
186
|
-
for (const candidate of group.rules) {
|
|
187
|
-
if (!candidate.path || !candidate.path.startsWith("/")) continue;
|
|
188
|
-
const pattern = normalizeRobotsPath(candidate.path);
|
|
189
|
-
if (!matchesRobotsPath(pattern, path)) continue;
|
|
190
|
-
const length = pattern.replace(/%[\da-f]{2}/gi, "_").length;
|
|
191
|
-
if (length > bestLength || (length === bestLength && candidate.type === "allow")) {
|
|
192
|
-
bestLength = length;
|
|
193
|
-
rule = candidate;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return { blocked: rule?.type === "disallow", via, groupName, rule };
|
|
198
|
-
}
|
|
199
|
-
|
|
200
89
|
// 기존 호출의 반환 형식과 기본 경로(/)를 유지한다.
|
|
201
90
|
export function robotsDecision(txt, agent, path = "/") {
|
|
202
|
-
const { blocked, via } = decideRobotsPath(
|
|
91
|
+
const { blocked, via } = decideRobotsPath(parseRobots(txt).groups, agent, normalizeRobotsPath(path));
|
|
203
92
|
return { blocked, via };
|
|
204
93
|
}
|
|
205
94
|
|
|
206
95
|
export function robotsAllowsPath(txt, agent) {
|
|
207
|
-
const groups =
|
|
96
|
+
const { groups } = parseRobots(txt);
|
|
208
97
|
return path => !decideRobotsPath(groups, agent, normalizeRobotsPath(path)).blocked;
|
|
209
98
|
}
|
|
210
99
|
|
|
@@ -214,7 +103,7 @@ export function robotsBlocksRoot(txt, agent) {
|
|
|
214
103
|
|
|
215
104
|
// ---------- 메인 점검 ----------
|
|
216
105
|
|
|
217
|
-
export function checkPage(p, add, baseUrl, { robotsHeaders = [], expectIndexable = false } = {}) {
|
|
106
|
+
export function checkPage(p, add, baseUrl, { robotsHeaders = [], linkHeader = [], expectIndexable = false, expectExcluded = false, headersObserved = Boolean(baseUrl), httpStatus = null } = {}) {
|
|
218
107
|
const abs = (u) => /^https?:\/\//i.test(u || "");
|
|
219
108
|
// 제목
|
|
220
109
|
if (!p.title) add("FAIL", t("공통", "General"), "<title>", t("없음", "Missing"), "google-search");
|
|
@@ -234,11 +123,13 @@ export function checkPage(p, add, baseUrl, { robotsHeaders = [], expectIndexable
|
|
|
234
123
|
}
|
|
235
124
|
if (p.h1.length === 0) add("WARN", t("공통", "General"), "<h1>", t("없음 — 페이지 기본 제목이 분명해야 함", "Missing. Provide a clear primary heading"), "google-search");
|
|
236
125
|
else if (p.h1.length > 1) add("INFO", t("공통", "General"), "<h1>", (currentLocale() === "en" ? `${p.h1.length}` : `${p.h1.length}개`), "google-search");
|
|
237
|
-
const canonical = checkCanonical(p, add, baseUrl);
|
|
126
|
+
const canonical = checkCanonical(p, add, baseUrl, linkHeader);
|
|
238
127
|
// robots meta
|
|
239
128
|
const metaTags = p.metaTags ?? Object.entries(p.meta).map(([name, content]) => ({ name, content }));
|
|
240
129
|
const rules = indexingRules(metaTags, robotsHeaders);
|
|
241
|
-
const
|
|
130
|
+
const intent = expectExcluded ? "exclude" : normalizeIntent(expectIndexable);
|
|
131
|
+
const indexing = indexingStatus({ rules, intent, headersObserved, httpStatus });
|
|
132
|
+
const pageNoindex = reportIndexing(rules, add, intent, indexing);
|
|
242
133
|
const appliesTo = (agent) => rules.filter(r => r.scope === "robots" || r.scope === agent).map(r => r.value);
|
|
243
134
|
const naver = appliesTo("yeti");
|
|
244
135
|
const bing = appliesTo("bingbot");
|
|
@@ -258,6 +149,10 @@ export function checkPage(p, add, baseUrl, { robotsHeaders = [], expectIndexable
|
|
|
258
149
|
else if (!p.icons.every(abs)) add("WARN", t("네이버", "Naver"), t("파비콘", "Favicon"), (currentLocale() === "en" ? `Relative path: ${p.icons.filter((u) => !abs(u)).join(", ")} (Naver requires absolute paths)` : `절대 경로 아님: ${p.icons.filter((u) => !abs(u)).join(", ")} (네이버는 절대 경로 요구)`), "naver-search");
|
|
259
150
|
if (p.verificationInBody) add("FAIL", t("네이버", "Naver"), t("소유 확인", "Ownership verification"), t("naver-site-verification이 <head> 밖에 있음", "naver-site-verification is outside <head>"), "naver-search");
|
|
260
151
|
else if (p.meta["naver-site-verification"]) add("INFO", t("네이버", "Naver"), t("소유 확인", "Ownership verification"), t("meta 있음", "Verification meta tag found"), "naver-search");
|
|
152
|
+
if (p.meta["google-site-verification"]) add("INFO", "Google", t("소유 확인", "Ownership verification"), t("google-site-verification meta 있음", "google-site-verification meta found"), "google-search");
|
|
153
|
+
if (p.meta["msvalidate.01"]) add("INFO", "Bing", t("소유 확인", "Ownership verification"), t("msvalidate.01 meta 있음", "msvalidate.01 meta found"), "other-search-engines");
|
|
154
|
+
if (p.meta["theme-color"]) add("INFO", t("브라우저", "Browser"), "theme-color", p.meta["theme-color"], "browser-compat");
|
|
155
|
+
if (p.meta["apple-mobile-web-app-title"]) add("INFO", "Apple", "apple-mobile-web-app-title", p.meta["apple-mobile-web-app-title"], "browser-compat");
|
|
261
156
|
// 본문·링크
|
|
262
157
|
if (p.bodyTextLength < 200) add("WARN", t("공통", "General"), t("서버 HTML 본문", "Server-rendered HTML body"), (currentLocale() === "en" ? `${p.bodyTextLength} characters of text. Search crawlers may miss content rendered on the client` : `텍스트 ${p.bodyTextLength}자 — 클라이언트 렌더링이면 검색로봇이 본문을 못 볼 수 있음`), "google-search");
|
|
263
158
|
const hashLinks = p.anchors.filter((h) => /^#\/|^#!/.test(h));
|
|
@@ -278,11 +173,11 @@ export function checkPage(p, add, baseUrl, { robotsHeaders = [], expectIndexable
|
|
|
278
173
|
if (p.meta["twitter:card"] && !p.meta["twitter:title"] && !p.meta["og:title"]) add("FAIL", "X", "twitter:title", t("없음(og:title도 없음)", "Missing (og:title is also missing)"), "social-preview");
|
|
279
174
|
const xImg = p.meta["twitter:image"] || p.meta["og:image"];
|
|
280
175
|
if (p.meta["twitter:image"] && !abs(p.meta["twitter:image"])) add("FAIL", "X", "twitter:image", t("절대 URL 아님", "Expected an absolute URL"), "social-preview");
|
|
281
|
-
return { ogImage: p.meta["og:image"], xImg, pageNoindex };
|
|
176
|
+
return { ogImage: p.meta["og:image"], xImg, pageNoindex, rules, intent, indexing };
|
|
282
177
|
}
|
|
283
178
|
|
|
284
179
|
async function fetchAuxiliary(url, network) {
|
|
285
|
-
if (!network) return fetch(url, { headers: { "user-agent": UA } });
|
|
180
|
+
if (!network) return fetch(url, { headers: { "user-agent": UA }, signal: AbortSignal.timeout(30_000) });
|
|
286
181
|
const resource = await fetchResource(url, UA, { ...network, accept: "*/*" });
|
|
287
182
|
// Fetch's Response API is also used by the standalone checker.
|
|
288
183
|
const emptyBody = [204, 205, 304].includes(resource.status);
|
|
@@ -307,113 +202,124 @@ async function checkImage(url, add, network) {
|
|
|
307
202
|
}
|
|
308
203
|
|
|
309
204
|
// [robots.txt 이름, 차단 시 수준, Skill, 설명]
|
|
310
|
-
export const ROBOT_AGENTS = [
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
["Claude-User", "WARN", "ai-crawlers", "Claude 사용자 요청 열람 불가"],
|
|
323
|
-
["PerplexityBot", "WARN", "ai-crawlers", "Perplexity 검색에서 빠짐"],
|
|
324
|
-
["Perplexity-User", "WARN", "ai-crawlers", "Perplexity 사용자 요청(대체로 robots 무시)"],
|
|
325
|
-
["meta-webindexer", "WARN", "ai-crawlers", "Meta AI 검색 인용에서 빠짐"],
|
|
326
|
-
["MistralAI-Index", "WARN", "ai-crawlers", "Mistral 검색에서 빠짐"],
|
|
327
|
-
["MistralAI-User", "WARN", "ai-crawlers", "Mistral 사용자 요청 열람 불가"],
|
|
328
|
-
["Google-Extended", "WARN", "ai-crawlers", "Gemini 앱·Vertex AI의 Google 검색 그라운딩에서 빠짐(Google 검색 자체엔 영향 없음)"],
|
|
329
|
-
["GPTBot", "INFO", "ai-crawlers", "OpenAI 학습 제외"],
|
|
330
|
-
["ClaudeBot", "INFO", "ai-crawlers", "Anthropic 학습 제외"],
|
|
331
|
-
["Applebot-Extended", "INFO", "ai-crawlers", "Apple 생성형 모델 학습 제외"],
|
|
332
|
-
["meta-externalagent", "INFO", "ai-crawlers", "Meta 학습 제외"],
|
|
333
|
-
["MistralAI-Training", "INFO", "ai-crawlers", "Mistral 학습 제외"],
|
|
334
|
-
["__usage_ai-training", "INFO", "ai-crawlers", "Microsoft AI 학습 제외(2027-02-01부터 반영)"],
|
|
335
|
-
];
|
|
205
|
+
export const ROBOT_AGENTS = CRAWLERS.map(({ agent, level, skill, note }) => [agent, level, skill, note]);
|
|
206
|
+
|
|
207
|
+
// 사이트 감사가 상호 참조를 판정할 때 쓰는 페이지 단위 기록.
|
|
208
|
+
export function hreflangRecord(page, requested) {
|
|
209
|
+
const canonicals = [...(page.canonical?.html ?? []), ...(page.canonical?.header ?? [])]
|
|
210
|
+
.map(({ url }) => url && comparableUrl(url)).filter(Boolean);
|
|
211
|
+
return {
|
|
212
|
+
url: page.hreflang?.url ?? null, requested, status: page.status, error: page.error,
|
|
213
|
+
noindex: Boolean(page.indexing?.blocks.some(({ scope }) => scope === "robots" || scope === "googlebot")),
|
|
214
|
+
canonicals: [...new Set(canonicals)], declarations: page.hreflang?.declarations ?? [],
|
|
215
|
+
};
|
|
216
|
+
}
|
|
336
217
|
|
|
337
|
-
function
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
218
|
+
export function hreflangSummary(declarations) {
|
|
219
|
+
const seen = new Set();
|
|
220
|
+
return declarations.filter(usable).filter(({ lang, url }) => {
|
|
221
|
+
const key = `${lang}\u0000${url}`;
|
|
222
|
+
return !seen.has(key) && seen.add(key);
|
|
223
|
+
}).map(({ lang, url }) => ({ lang, url }));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function trimHreflang(hreflang) {
|
|
227
|
+
if (!hreflang) return;
|
|
228
|
+
Object.assign(hreflang, keptDeclarations(hreflang.declarations));
|
|
229
|
+
hreflang.alternates = hreflang.alternates.slice(0, hreflang.declarations.length);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function addHreflangFindings(findings, add) {
|
|
233
|
+
for (const finding of findings) {
|
|
234
|
+
add(finding.level, t("다국어", "International"), finding.item, describeHreflang(finding, currentLocale()), "google-search");
|
|
353
235
|
}
|
|
354
|
-
return { alternates, url: baseUrl };
|
|
355
236
|
}
|
|
356
237
|
|
|
357
|
-
|
|
238
|
+
// 500 KiB를 넘는 부분은 readRobots가 잘라 내므로, 큰 파일도 실패하지 않게 페이지 한도와 별도로 넉넉히 받는다.
|
|
239
|
+
const ROBOTS_FETCH_BYTES = 16 * 1024 * 1024;
|
|
240
|
+
|
|
241
|
+
// robots.txt는 요청 정책 자체를 읽는 요청이다. 페이지의 출처 제한과 robots 차단 규칙을 적용하지 않고
|
|
242
|
+
// 다른 출처로의 리다이렉트도 리다이렉트 한도 안에서 따라간다. CLI의 점검과 크롤링이 함께 쓴다.
|
|
243
|
+
export async function fetchRobots(url, { signal } = {}) {
|
|
244
|
+
const location = new URL("/robots.txt", url);
|
|
358
245
|
try {
|
|
359
|
-
const res = await
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
246
|
+
const res = await fetchResource(location, UA, {
|
|
247
|
+
signal, maxBytes: ROBOTS_FETCH_BYTES, accept: "*/*", readBody: ({ status }) => status >= 200 && status < 300,
|
|
248
|
+
});
|
|
249
|
+
const body = res.bytes ? new TextDecoder().decode(res.bytes) : "";
|
|
250
|
+
return readRobots({ url: location.href, status: res.status, body, contentType: res.headers["content-type"] || "" });
|
|
251
|
+
} catch (error) {
|
|
252
|
+
const timeout = ["AbortError", "TimeoutError"].includes(error.name) || error.code === "ABORT_ERR";
|
|
253
|
+
return readRobots({ url: location.href, error: String(error.message).slice(0, 120), errorKind: timeout ? "timeout" : "network" });
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// 크롤러의 용도(role)를 보고서의 분류로 바꾼다.
|
|
258
|
+
const PURPOSES = { search: "search", "ai-search": "search", "ai-user": "user-request", "ai-grounding": "grounding", "ai-training": "training", social: "preview" };
|
|
259
|
+
|
|
260
|
+
async function checkRobots(url, add, pageNoindex = false, intent = "unspecified", network) {
|
|
261
|
+
const source = await fetchRobots(url, { signal: network?.signal });
|
|
262
|
+
const { fetch: result, groups, sitemaps } = source;
|
|
263
|
+
const target = robotsPathFor(url);
|
|
264
|
+
const locale = currentLocale();
|
|
265
|
+
const rows = (ai) => CRAWLERS.filter(({ skill }) => (skill === "ai-crawlers") === ai)
|
|
266
|
+
.map(({ agent, role }) => ({ agent, purpose: PURPOSES[role], ...evaluateRobots(source, agent, target) }));
|
|
267
|
+
const report = { path: target, fetch: result, sitemaps, crawlers: rows(true), otherCrawlers: rows(false) };
|
|
268
|
+
if (result.state === "no-file") {
|
|
269
|
+
const handling = [...new Set(["Googlebot", "Yeti", "Bingbot"].map(agent => describeRobotsHandling(source, robotsEngine(agent), locale)))].join(" · ");
|
|
270
|
+
add("INFO", t("공통", "General"), "robots.txt", `${target} — ${describeRobotsFetch(source, locale)}. ${handling}`, "naver-search");
|
|
271
|
+
return report;
|
|
272
|
+
}
|
|
273
|
+
if (result.state !== "read") {
|
|
274
|
+
const level = result.state === "server-error" ? "FAIL" : "WARN";
|
|
275
|
+
const handling = [...new Set(["Googlebot", "Yeti"].map(agent => describeRobotsHandling(source, robotsEngine(agent), locale)))].join(" · ");
|
|
276
|
+
const unverified = t("크롤러의 허용·차단 여부는 미확인이며, 이전 캐시와 실제 봇의 접근은 미관측입니다.",
|
|
277
|
+
"Crawler access is unverified. Cached copies and actual bot access were not observed.");
|
|
278
|
+
add(level, t("공통", "General"), "robots.txt", `${target} — ${describeRobotsFetch(source, locale)}. ${unverified} ${handling}`,
|
|
279
|
+
result.state === "server-error" ? "naver-search" : "google-search");
|
|
280
|
+
return report;
|
|
281
|
+
}
|
|
282
|
+
if (result.html) add("WARN", t("공통", "General"), "robots.txt", t("HTML로 응답 — 네이버는 '없음'으로 볼 수 있음. text/plain 권장", "Returned HTML. Naver may treat the file as missing. Use text/plain"), "naver-search");
|
|
283
|
+
if (result.truncated) add("INFO", t("공통", "General"), "robots.txt", `${target} — ${describeRobotsFetch(source, locale)}`, "google-search");
|
|
284
|
+
const path = normalizeRobotsPath(target);
|
|
285
|
+
const wildcard = [];
|
|
286
|
+
let wildcardRule = null;
|
|
287
|
+
let blockedAi = false;
|
|
288
|
+
for (const [agent, level, skill] of ROBOT_AGENTS) {
|
|
289
|
+
const { blocked, via, groupName, rule } = decideRobotsPath(groups, agent, path);
|
|
290
|
+
if (!rule) continue;
|
|
291
|
+
if (blocked && level !== "INFO" && skill === "ai-crawlers") blockedAi = true;
|
|
292
|
+
// 같은 * 규칙을 적용받는 봇은 한 줄에 표시한다.
|
|
293
|
+
if (via === "*") {
|
|
294
|
+
wildcard.push({ agent, level });
|
|
295
|
+
wildcardRule = rule;
|
|
296
|
+
continue;
|
|
392
297
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
298
|
+
const channel = level === "INFO" ? t("AI 학습", "AI training") : skill === "ai-crawlers" ? t("AI 검색", "AI search") : t("공통", "General");
|
|
299
|
+
const evidence = `User-agent: ${groupName}, ${rule.type}: ${rule.path}`;
|
|
300
|
+
add(blocked ? level : "INFO", channel, `robots.txt ${agent}`, `${target} — ${blocked ? t("차단", "Blocked") : t("허용", "Allowed")} (${evidence})`, skill);
|
|
301
|
+
}
|
|
302
|
+
if (wildcardRule) {
|
|
303
|
+
const blocked = wildcardRule.type === "disallow";
|
|
304
|
+
const names = wildcard.map(({ agent }) => agent).join(", ");
|
|
305
|
+
const msg = (currentLocale() === "en" ? `${target} — ${blocked ? t("차단", "Blocked") : t("허용", "Allowed")} (User-agent: *, ${wildcardRule.type}: ${wildcardRule.path}). Applies to: ${names}` : `${target} — ${blocked ? t("차단", "Blocked") : t("허용", "Allowed")} (User-agent: *, ${wildcardRule.type}: ${wildcardRule.path}). 적용 대상: ${names}`);
|
|
306
|
+
if (blocked && pageNoindex && intent !== "index") {
|
|
307
|
+
add("INFO", t("공통", "General"), t("비공개 상태", "Private access"), (currentLocale() === "en" ? `${msg}. The page also declares noindex. Confirm whether it should be public` : `${msg}. 페이지에도 noindex가 있어 공개 의도 확인 필요`), "seo-orchestrator");
|
|
308
|
+
} else {
|
|
309
|
+
const level = ["FAIL", "WARN", "INFO"].find((severity) => wildcard.some((bot) => bot.level === severity));
|
|
310
|
+
add(blocked ? level : "INFO", t("공통", "General"), "robots.txt *", msg, "google-search");
|
|
403
311
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (!res.ok || /text\/html/i.test(ct)) return;
|
|
409
|
-
return { path: target, sitemaps, crawlers };
|
|
410
|
-
} catch (e) { add("WARN", t("공통", "General"), "robots.txt", (currentLocale() === "en" ? `Fetch failed: ${String(e.message).slice(0, 80)}` : `가져오기 실패: ${String(e.message).slice(0, 80)}`), "google-search"); }
|
|
312
|
+
}
|
|
313
|
+
if (!blockedAi) add("INFO", t("AI 검색", "AI search"), "robots.txt", (currentLocale() === "en" ? `${target} — No blocking rule found for the AI search and user-request crawlers checked. Verify access and visibility separately` : `${target} — 점검 대상 AI 검색·사용자 요청 크롤러의 차단 규칙 없음. 실제 접근·노출은 별도 확인`), "ai-crawlers");
|
|
314
|
+
add(sitemaps.length ? "INFO" : "WARN", t("공통", "General"), "robots.txt Sitemap", sitemaps.length ? sitemaps.join(", ") : t("Sitemap: 줄 없음", "Missing Sitemap: directive"), "google-search");
|
|
315
|
+
return report;
|
|
411
316
|
}
|
|
412
317
|
|
|
413
|
-
export async function run(target, { expectIndexable = false, network, llmsByOrigin = new Map(), fetchedPage } = {}) {
|
|
318
|
+
export async function run(target, { expectIndexable = false, expectExcluded = false, network, llmsByOrigin = new Map(), fetchedPage, deferHreflang = false } = {}) {
|
|
414
319
|
const results = [];
|
|
415
320
|
const add = (level, channel, item, detail, skill) => results.push({ level, channel, item, detail, skill });
|
|
416
|
-
let html, baseUrl = null, robots,
|
|
321
|
+
let html, baseUrl = null, robots, status, llms, parsed, checked, structuredData;
|
|
322
|
+
let linkHeader = [];
|
|
417
323
|
if (/^https?:\/\//i.test(target)) {
|
|
418
324
|
const page = fetchedPage ?? await fetchPage(target, UA, network);
|
|
419
325
|
const { chain, finalUrl } = page;
|
|
@@ -430,13 +336,14 @@ export async function run(target, { expectIndexable = false, network, llmsByOrig
|
|
|
430
336
|
const lastOgByte = lastOgIndex < 0 ? 0 : Buffer.byteLength(html.slice(0, lastOgIndex));
|
|
431
337
|
if (lastOgByte > 1024 * 1024) add("WARN", t("공유", "Sharing"), t("og 위치", "Open Graph position"), (currentLocale() === "en" ? `Open Graph tag at ${Math.round(lastOgByte / 1024)} KB in HTML. Meta reads the first 1 MB` : `og 태그가 HTML ${Math.round(lastOgByte / 1024)}KB 지점 — Meta는 첫 1MB만 읽음`), "social-preview");
|
|
432
338
|
if (/http-equiv\s*=\s*["']?refresh/i.test(html)) add("WARN", t("네이버", "Naver"), "meta refresh", t("있음 — 네이버 소유 확인·수집에서 해석하지 않음. HTTP 리다이렉트 사용", "Present. Naver does not interpret this for verification or crawling. Use an HTTP redirect"), "naver-search");
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
339
|
+
parsed = parseHtml(html);
|
|
340
|
+
linkHeader = parseLinkHeader(page.linkHeaders ?? [], baseUrl);
|
|
341
|
+
checked = checkPage(parsed, add, baseUrl, { robotsHeaders: page.robotsHeaders, linkHeader, expectIndexable, expectExcluded, httpStatus: status });
|
|
342
|
+
structuredData = checkJsonLd(parsed.jsonLd, add);
|
|
343
|
+
const { ogImage, pageNoindex, intent } = checked;
|
|
436
344
|
if (ogImage && /^https?:/i.test(ogImage)) await checkImage(ogImage, add, network);
|
|
437
|
-
hreflang = reportHreflang(p, add, baseUrl);
|
|
438
345
|
const final = new URL(baseUrl);
|
|
439
|
-
robots = await checkRobots(final, add, pageNoindex,
|
|
346
|
+
robots = await checkRobots(final, add, pageNoindex, intent, network);
|
|
440
347
|
if (!llmsByOrigin.has(final.origin)) {
|
|
441
348
|
llmsByOrigin.set(final.origin, auditLlms(final.origin, UA, network));
|
|
442
349
|
}
|
|
@@ -446,16 +353,42 @@ export async function run(target, { expectIndexable = false, network, llmsByOrig
|
|
|
446
353
|
}
|
|
447
354
|
} else {
|
|
448
355
|
html = await readFile(target, "utf8");
|
|
449
|
-
|
|
450
|
-
checkPage(
|
|
451
|
-
|
|
452
|
-
checkJsonLd(p.jsonLd, add);
|
|
356
|
+
parsed = parseHtml(html);
|
|
357
|
+
checked = checkPage(parsed, add, null, { expectIndexable, expectExcluded });
|
|
358
|
+
structuredData = checkJsonLd(parsed.jsonLd, add);
|
|
453
359
|
add("INFO", t("공통", "General"), t("범위", "Scope"), t("로컬 파일: HTTP 헤더·robots.txt·리다이렉트·이미지 응답은 확인하지 않음", "Local file. HTTP headers, robots.txt, redirects and image responses were skipped"), "seo-orchestrator");
|
|
454
360
|
}
|
|
455
|
-
|
|
361
|
+
const pageUrl = baseUrl && comparableUrl(baseUrl);
|
|
362
|
+
const { indexing } = checked;
|
|
363
|
+
const crawlBlocked = unreadableExclusions(indexing, [...(robots?.crawlers ?? []), ...(robots?.otherCrawlers ?? [])]);
|
|
364
|
+
if (crawlBlocked.length) {
|
|
365
|
+
indexing.crawlBlocked = crawlBlocked;
|
|
366
|
+
add("WARN", t("공통", "General"), t("색인 제외 의도", "Exclusion intent"), describeCrawlBlock(crawlBlocked, currentLocale()), "google-search");
|
|
367
|
+
}
|
|
368
|
+
const declarations = pageDeclarations({ html: parsed.alternates, linkHeader, page: pageUrl ?? target });
|
|
369
|
+
const result = {
|
|
370
|
+
target, finalUrl: baseUrl, checkedAt: new Date().toISOString(), results, status,
|
|
371
|
+
hreflang: { url: pageUrl, alternates: hreflangSummary(declarations), declarations },
|
|
372
|
+
robots, llms, structuredData,
|
|
373
|
+
indexing,
|
|
374
|
+
canonical: canonicalDeclarations(parsed, baseUrl, linkHeader),
|
|
375
|
+
};
|
|
376
|
+
if (!deferHreflang) {
|
|
377
|
+
// 사이트 감사와 달리 한 페이지만 보므로 웹 결과처럼 읽지 않은 범위를 밝힌다.
|
|
378
|
+
add("INFO", t("다국어", "International"), "hreflang scope", baseUrl
|
|
379
|
+
? t("확인 범위: 이 URL 응답의 HTML <head>와 HTTP Link 헤더. 사이트맵과 상대 페이지는 확인하지 않음",
|
|
380
|
+
"Scope: the HTML <head> and HTTP Link header of this response. Sitemaps and counterpart pages were not checked")
|
|
381
|
+
: t("확인 범위: 이 파일의 HTML <head>. 사이트맵과 상대 페이지는 확인하지 않음",
|
|
382
|
+
"Scope: the HTML <head> of this file. Sitemaps and counterpart pages were not checked"), "google-search");
|
|
383
|
+
const requested = baseUrl ? comparableUrl(target) : null;
|
|
384
|
+
const [findings] = analyzeHreflang([hreflangRecord(result, requested)], { singlePage: true });
|
|
385
|
+
addHreflangFindings(findings, add);
|
|
386
|
+
trimHreflang(result.hreflang);
|
|
387
|
+
}
|
|
388
|
+
return result;
|
|
456
389
|
}
|
|
457
390
|
|
|
458
|
-
function toMarkdown({ target, checkedAt, results }) {
|
|
391
|
+
function toMarkdown({ target, checkedAt, results, indexing }) {
|
|
459
392
|
const icon = { FAIL: "❌", WARN: "⚠️", INFO: "ℹ️" };
|
|
460
393
|
const order = { FAIL: 0, WARN: 1, INFO: 2 };
|
|
461
394
|
const grouped = new Map();
|
|
@@ -470,6 +403,12 @@ function toMarkdown({ target, checkedAt, results }) {
|
|
|
470
403
|
`## seo-check: ${target}`,
|
|
471
404
|
(currentLocale() === "en" ? `Checked at ${checkedAt} · ❌ ${count("FAIL")} · ⚠️ ${count("WARN")} · ℹ️ ${count("INFO")}` : `확인 시각 ${checkedAt} · ❌ ${count("FAIL")} · ⚠️ ${count("WARN")} · ℹ️ ${count("INFO")}`),
|
|
472
405
|
"",
|
|
406
|
+
...(indexing?.blocks.length || indexing?.intent === "exclude" ? [
|
|
407
|
+
`**${describeIndexing(indexing, currentLocale()).title}**`,
|
|
408
|
+
...indexing.blocks.map(block => `- ${describeBlock(block, currentLocale())}`),
|
|
409
|
+
...(indexing.omitted ? [`- … +${indexing.omitted}`] : []),
|
|
410
|
+
"",
|
|
411
|
+
] : []),
|
|
473
412
|
t("| 상태 | 채널 | 항목 | 내용 | Skill |", "| Status | Channel | Check | Details | Skill |"),
|
|
474
413
|
"| --- | --- | --- | --- | --- |",
|
|
475
414
|
...rows.map((r) => `| ${icon[r.level]} | ${r.channel} | ${r.item}${r.n > 1 ? ` ×${r.n}` : ""} | ${String(r.detail).replace(/\|/g, "\\|")} | ${r.skill} |`),
|
|
@@ -487,19 +426,20 @@ async function main() {
|
|
|
487
426
|
crawl: { type: "boolean" },
|
|
488
427
|
"max-pages": { type: "string" },
|
|
489
428
|
"expect-indexable": { type: "boolean" },
|
|
429
|
+
"expect-excluded": { type: "boolean" },
|
|
490
430
|
help: { type: "boolean", short: "h" },
|
|
491
431
|
},
|
|
492
432
|
});
|
|
493
433
|
return withLocale(values.lang ?? "ko", async () => {
|
|
494
434
|
const help = t(
|
|
495
|
-
"사용법: node scripts/seo-check.mjs <URL | HTML 파일> [--json] [--expect-indexable] [--crawl [--max-pages n]] [--lang en|ko]",
|
|
496
|
-
"Usage: node scripts/seo-check.mjs <URL | HTML file> [--json] [--expect-indexable] [--crawl [--max-pages n]] [--lang en|ko]",
|
|
435
|
+
"사용법: node scripts/seo-check.mjs <URL | HTML 파일> [--json] [--expect-indexable | --expect-excluded] [--crawl [--max-pages n]] [--lang en|ko]",
|
|
436
|
+
"Usage: node scripts/seo-check.mjs <URL | HTML file> [--json] [--expect-indexable | --expect-excluded] [--crawl [--max-pages n]] [--lang en|ko]",
|
|
497
437
|
);
|
|
498
438
|
if (values.help) {
|
|
499
439
|
console.log(help);
|
|
500
440
|
return 0;
|
|
501
441
|
}
|
|
502
|
-
if (positionals.length !== 1) throw new Error(help);
|
|
442
|
+
if (positionals.length !== 1 || (values["expect-indexable"] && values["expect-excluded"])) throw new Error(help);
|
|
503
443
|
try {
|
|
504
444
|
const { crawlLimit, crawlSite, crawlLines } = await import("./internal-crawl.mjs");
|
|
505
445
|
const maxPages = crawlLimit(values.crawl, values["max-pages"]);
|
|
@@ -508,7 +448,7 @@ async function main() {
|
|
|
508
448
|
const report = scope && !scope.seedPage
|
|
509
449
|
? { target, checkedAt: new Date().toISOString(), results: [] }
|
|
510
450
|
: await run(target, {
|
|
511
|
-
expectIndexable: values["expect-indexable"], fetchedPage: scope?.seedPage,
|
|
451
|
+
expectIndexable: values["expect-indexable"], expectExcluded: values["expect-excluded"], fetchedPage: scope?.seedPage,
|
|
512
452
|
network: scope ? { allowedOrigin: scope.origin, allowRequest: scope.allowRequest, maxBytes: 2 * 1024 * 1024, signal: AbortSignal.timeout(5000) } : undefined,
|
|
513
453
|
});
|
|
514
454
|
if (scope) report.crawl = scope.report;
|