22 lines
754 B
TypeScript
22 lines
754 B
TypeScript
|
|
// Helper script to run IndexNow submission
|
|
// Run with: npx tsx scripts/submit-indexnow.ts
|
|
|
|
import { getAllIndexableUrls, submitToIndexNow } from '../src/lib/indexnow';
|
|
|
|
async function main() {
|
|
console.log('Gathering URLs for IndexNow submission...');
|
|
const urls = getAllIndexableUrls();
|
|
console.log(`Found ${urls.length} indexable URLs.`);
|
|
|
|
// Basic validation of key presence (logic can be improved)
|
|
if (!process.env.INDEXNOW_KEY) {
|
|
console.warn('⚠️ WARNING: INDEXNOW_KEY environment variable is not set. Using placeholder.');
|
|
// In production, you'd fail here. For dev/demo, we proceed but expect failure from API.
|
|
}
|
|
|
|
await submitToIndexNow(urls);
|
|
}
|
|
|
|
main().catch(console.error);
|