Bunny-Agency-Italy/scripts/submit-indexnow.mjs
BigMarc 67ea5d48be Initial commit: Bunny Agency Italia (it-IT) marketing site
Italian-market site for the Bunny Agency network, built on the shared
Next.js App Router template with content driven from site-content.json.

- 50 routes: home, 5 services, pricing, FAQ, about/apply/contact,
  32 blog answers and guides, 5 legal pages
- Research-driven Italian copy citing ISTAT, INPS and Agenzia delle Entrate
  (forfettario 15%/5%, ATECO 73.11.03, INPS 26,07%, tassa etica, DAC7)
- 6 long-form guides targeting high-volume Italian creator searches
- "Milanese Editoriale" design system with stats band, editorial article
  layout, creator gallery and footer language switcher to 18 sibling sites
- Full SEO/AEO/GEO: JSON-LD entity graph, hreflang cluster, llms.txt,
  IndexNow, sitemap, AI-crawler-friendly robots
- validate-seo.mjs passes with 0 errors

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 09:00:28 +02:00

8 lines
1.3 KiB
JavaScript

import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url";
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),".."); const data=JSON.parse(fs.readFileSync(path.join(root,"src/content/site-content.json"),"utf8"));
const site=(process.env.NEXT_PUBLIC_SITE_URL||data.site.url).replace(/\/+$/,""); const key="cd6b5f316aa84975136f630f3eb1cd02"; const keyLocation=site+"/"+key+".txt";
const urls=data.pages.filter((p)=>p.indexable).map((p)=>site+(p.path==="/"?"":p.path));
const keyResponse=await fetch(keyLocation,{redirect:"follow"}); if(!keyResponse.ok||(await keyResponse.text()).trim()!==key)throw new Error("IndexNow key is not live at "+keyLocation);
const checks=await Promise.all(urls.map(async(url)=>[url,(await fetch(url,{method:"HEAD",redirect:"follow"})).status])); const bad=checks.filter(([,status])=>status!==200); if(bad.length)throw new Error("Refusing submission; non-200 URLs: "+JSON.stringify(bad));
const response=await fetch("https://api.indexnow.org/indexnow",{method:"POST",headers:{"content-type":"application/json; charset=utf-8"},body:JSON.stringify({host:new URL(site).host,key,keyLocation,urlList:urls})});
if(!response.ok)throw new Error("IndexNow "+response.status+" "+await response.text()); console.log("IndexNow accepted "+urls.length+" URLs for "+site);