@webnumseoagent/next 0.1.23 → 0.1.24
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/bin/cli.mjs +7 -0
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -224,6 +224,13 @@ async function init() {
|
|
|
224
224
|
`import { revalidateTag } from "next/cache";\n\nexport async function POST(req${ext === "ts" ? ": Request" : ""}) {\n if (req.headers.get("x-revalidate-secret") !== process.env.SEOAGENT_REVALIDATE_SECRET) {\n return new Response("unauthorized", { status: 401 });\n }\n revalidateTag(\`seo-\${process.env.SEOAGENT_SITE_ID}\`);\n return Response.json({ ok: true });\n}\n`,
|
|
225
225
|
);
|
|
226
226
|
|
|
227
|
+
// 4.2 IndexNow — ключ-файл /seoagent-indexnow.txt (адаптер отдаёт ключ из конфига платформы;
|
|
228
|
+
// платформа пингует IndexNow при изменениях). Расширение route.${ext} — как у остальных роутов.
|
|
229
|
+
await ensureFile(
|
|
230
|
+
path.join(root, appDir, `seoagent-indexnow.txt/route.${ext}`),
|
|
231
|
+
`import { seoIndexNowKey } from "${clientFor("seoagent-indexnow.txt/route.ts")}";\nexport const dynamic = "force-dynamic";\nexport async function GET() {\n return new Response(await seoIndexNowKey(), { headers: { "content-type": "text/plain; charset=utf-8" } });\n}\n`,
|
|
232
|
+
);
|
|
233
|
+
|
|
227
234
|
// 4.5 middleware (переадресации). Next разрешает ОДИН middleware, а авто-слияние чужого
|
|
228
235
|
// небезопасно → создаём свой, только если своего нет; иначе печатаем ручную инструкцию.
|
|
229
236
|
{
|
package/package.json
CHANGED