From ccc2464e4d1393e6588584257a0f96c8452af1cf Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Nov 2026 21:57:36 +0000 Subject: [PATCH] SEO: restore operator titles, noindex thin archive pages, drop FAQ and Product markup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Aircraft titles go back to "VT-IAO · Airbus A320 · IndiGo · VT Aircrafts", the format the pages ranked with. The 29 Oct "owner and operator" titles dropped the operator name and the brand from every aircraft page at once. - 212 archived registrations with nothing but a register line (no owner, no operator, no flying school) get noindex, follow and leave the sitemap (4,533 -> 4,321 URLs). - FAQPage JSON-LD removed from aircraft pages: no rich result for this kind of site, and it repeated the same templated Q&A across ~3,600 pages. The visible "About" block stays. - ItemPage "about" is no longer a Product, which Google flags as invalid without offers, reviews or ratings. - scripts/seo-check.mjs runs in CI after the build: every sitemap URL has a page, is canonical to itself, is indexable and has a unique title; robots.txt allows the site. --- .github/workflows/ci.yml | 1 + package.json | 3 ++- scripts/seo-check.mjs | 41 +++++++++++++++++++++++++++++++++ src/app/aircraft/[reg]/page.tsx | 12 +++++----- src/app/sitemap.ts | 3 ++- src/lib/answers.ts | 28 +++++++++++----------- 6 files changed, 67 insertions(+), 21 deletions(-) create mode 100644 scripts/seo-check.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4efc87..ddc9240 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,3 +18,4 @@ jobs: - run: npm run lint - run: npm run typecheck - run: npm run build + - run: npm run seo:check diff --git a/package.json b/package.json index 93dbbf6..369caea 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "pipeline:warm": "tsx pipeline/warm.ts", "og": "tsx scripts/og.ts", "pipeline:extras": "tsx pipeline/extras.ts", - "indexnow": "node scripts/indexnow.mjs" + "indexnow": "node scripts/indexnow.mjs", + "seo:check": "node scripts/seo-check.mjs" }, "dependencies": { "@fontsource-variable/inter": "^5.3.0", diff --git a/scripts/seo-check.mjs b/scripts/seo-check.mjs new file mode 100644 index 0000000..91adc4e --- /dev/null +++ b/scripts/seo-check.mjs @@ -0,0 +1,41 @@ +// Check the static export the way a crawler sees it: every sitemap URL has a page, that page is +// canonical to itself, is indexable, and has its own title. Run after `npm run build`. +import { existsSync, readFileSync } from "node:fs"; + +const ORIGIN = "https://vtaircrafts.in"; +const xml = readFileSync("out/sitemap.xml", "utf8"); +const urls = [...xml.matchAll(/([^<]+)<\/loc>/g)].map((m) => m[1]); +const problems = []; +const titles = new Map(); + +for (const url of urls) { + if (!url.startsWith(ORIGIN)) { + problems.push(`${url}: not on ${ORIGIN}`); + continue; + } + const path = url.slice(ORIGIN.length) || "/"; + const file = path === "/" ? "out/index.html" : [`out${path}.html`, `out${path}/index.html`].find(existsSync); + if (!file || !existsSync(file)) { + problems.push(`${path}: no page in out/`); + continue; + } + const html = readFileSync(file, "utf8"); + const canonical = html.match(/([^<]*)<\/title>/)?.[1]?.trim(); + if (!title) problems.push(`${path}: no title`); + else titles.set(title, [...(titles.get(title) ?? []), path]); +} + +for (const [title, paths] of titles) if (paths.length > 1) problems.push(`title "${title}" on ${paths.join(", ")}`); + +const robots = readFileSync("out/robots.txt", "utf8"); +if (/^Disallow:\s*\/\s*$/im.test(robots)) problems.push("robots.txt disallows the whole site"); + +console.log(`checked ${urls.length} sitemap URLs`); +if (problems.length) { + console.error(problems.slice(0, 50).join("\n")); + console.error(`${problems.length} SEO problems`); + process.exit(1); +} diff --git a/src/app/aircraft/[reg]/page.tsx b/src/app/aircraft/[reg]/page.tsx index eb2ef09..24e0ee8 100644 --- a/src/app/aircraft/[reg]/page.tsx +++ b/src/app/aircraft/[reg]/page.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { notFound } from "next/navigation"; import { getAircraft, getAircraftByReg, getArchive, getArchivedByReg, getEventsFor, getMeta, getOperator } from "@/lib/data"; import { ageOf } from "@/lib/registry"; -import { answersFor, archivedAnswersFor, faqJsonLd } from "@/lib/answers"; +import { answersFor, archivedAnswersFor, isThinArchive } from "@/lib/answers"; import { Container } from "@/components/ui/Container"; import { Photo, PhotoCredit } from "@/components/ui/Photo"; import { Placard } from "@/components/aircraft/Placard"; @@ -39,6 +39,7 @@ export async function generateMetadata({ params }: PageProps<"/aircraft/[reg]">) description: ans.description, alternates: { canonical }, openGraph: { title: ans.title, description: ans.description }, + ...(isThinArchive(h) ? { robots: { index: false, follow: true } } : {}), }; } @@ -71,16 +72,16 @@ export default async function AircraftPage({ params }: PageProps<"/aircraft/[reg url: `https://vtaircrafts.in/aircraft/${a.reg}`, description: ans.lede, dateModified: getMeta().generatedAt, + // Not "Product": Google validates Product markup for offers, reviews or ratings and flags every page without them. about: { - "@type": "Product", + "@type": "Thing", + additionalType: "https://www.wikidata.org/wiki/Q11436", name: `${a.type.name} ${a.reg}`, identifier: a.reg, - manufacturer: { "@type": "Organization", name: a.type.manufacturer }, - ...(a.history?.msn ? { serialNumber: a.history.msn } : {}), + description: `${a.type.name}${a.history?.msn ? `, MSN ${a.history.msn}` : ""}`, ...(a.image ? { image: a.image.src } : {}), }, }, - faqJsonLd(ans.answers), ]} /> @@ -151,7 +152,6 @@ function ArchivedAircraftPage({ reg }: { reg: string }) { description: ans.lede, dateModified: getMeta().generatedAt, }, - faqJsonLd(ans.answers), ]} /> diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index cad182d..9d7155c 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -1,6 +1,7 @@ import type { MetadataRoute } from "next"; import { getAircraft, getArchive, getMeta, getOperators, getPastOperators, getTraining } from "@/lib/data"; import { getOwnerPages, getRegister, getTypes } from "@/lib/registry"; +import { isThinArchive } from "@/lib/answers"; export const dynamic = "force-static"; @@ -19,6 +20,6 @@ export default function sitemap(): MetadataRoute.Sitemap { ...(getTraining()?.ftos ?? []).map((f) => page(`/flying-schools/${f.id}`, 0.5)), ...getAircraft().map((a) => page(`/aircraft/${a.reg}`, 0.6)), ...getPastOperators().map((o) => page(`/operators/${o.id}`, 0.4)), - ...getArchive().map((a) => page(`/aircraft/${a.reg}`, 0.3)), + ...getArchive().filter((a) => !isThinArchive(a)).map((a) => page(`/aircraft/${a.reg}`, 0.3)), ]; } diff --git a/src/lib/answers.ts b/src/lib/answers.ts index c508976..b7195a4 100644 --- a/src/lib/answers.ts +++ b/src/lib/answers.ts @@ -94,7 +94,9 @@ function current(a: Aircraft) { } return { - title: `${a.reg}: ${named}, owner and operator`, + // The registration, type and operator, the format these pages ranked with through October. + // The 29 Oct "owner and operator" wording dropped the operator name from every title. + title: `${a.reg} · ${a.type.name} · ${a.operator} · VT Aircrafts`, description: `${lede}${facts.length ? ` ${capitalise(facts.join(", "))}.` : ""}`, lede, answers, @@ -136,11 +138,12 @@ function archived(h: ArchivedAircraft, sentence: string) { : `${h.reg} is not on any scheduled or non-scheduled operator permit in DGCA's latest lists, as on ${asOn}.`, }); - const title = h.training - ? `${h.reg}: ${h.type.name} trainer, ${h.training.fto.replace(/\.$/, "")}` - : operators.length - ? `${h.reg}: ex-${operators.at(-1)} ${h.type.name}, owner and history` - : `${h.reg}: ${named}, ${owner ? "owner and history" : "history"}`; + const title = [ + h.reg, + h.type.name, + h.training ? h.training.fto.replace(/\.$/, "") : operators.length ? `ex-${operators.at(-1)}` : h.status === "deregistered" ? "deregistered" : "Indian register", + "VT Aircrafts", + ].join(" · "); return { title, description: `${h.reg} ${sentence}${owner ? ` Last registered owner: ${owner}.` : ""}`, @@ -164,11 +167,10 @@ export function archivedAnswersFor(h: ArchivedAircraft, summary: { sentence: str return archived(h, summary.sentence); } -/** schema.org FAQPage for a question list. */ -export function faqJsonLd(answers: Answer[]): object { - return { - "@context": "https://schema.org", - "@type": "FAQPage", - mainEntity: answers.map((x) => ({ "@type": "Question", name: x.q, acceptedAnswer: { "@type": "Answer", text: x.a } })), - }; +/** + * An archived registration with nothing beyond its DGCA register line: no owner, no operator history + * and no flying school. These pages stay reachable but are kept out of the index and the sitemap. + */ +export function isThinArchive(h: ArchivedAircraft): boolean { + return !h.training && h.stints.length === 0 && !ownerName(h.owner)?.name; }