IndexNow is a protocol that allows websites to instantly notify search engines about content updates. This implementation supports Bing, Yandex, and all other search engines that participate in the IndexNow protocol.
- Location:
/public/51c2d562781e4992ab751d34d23f9ab7.txt - Purpose: Verifies your ownership of the domain to search engines
- Key:
51c2d562781e4992ab751d34d23f9ab7
- Location:
/lib/indexnow.ts - Functions:
submitUrlToIndexNow(url: string)- Submit a single URLsubmitUrlsToIndexNow(urls: string[])- Submit multiple URLs (up to 10,000 per batch)submitCommonPages()- Submit frequently updated pages
- Location:
/app/api/indexnow/route.ts - Endpoints:
GET /api/indexnow- Verify IndexNow configurationPOST /api/indexnow- Submit URLs programmatically
- Location:
/scripts/submit-to-indexnow.ts - Purpose: Submit all sitemap URLs to search engines at once
Run this command to submit all your sitemap URLs to search engines:
```bash npm run indexnow ```
or
```bash pnpm indexnow ```
This will:
- Fetch all URLs from your sitemap (https://www.bigjson.online/sitemap.xml)
- Submit them to Bing, Yandex, and the central IndexNow API
- Display the results for each search engine
Use the API route to submit URLs when content changes:
```typescript // Submit a single URL await fetch('/api/indexnow', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://www.bigjson.online/en/new-blog-post' }) });
// Submit multiple URLs await fetch('/api/indexnow', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ urls: [ 'https://www.bigjson.online/en/post-1', 'https://www.bigjson.online/en/post-2', 'https://www.bigjson.online/en/post-3' ] }) }); ```
Import and use the utility functions in your code:
```typescript import { submitUrlToIndexNow, submitCommonPages } from '@/lib/indexnow';
// Submit when creating/updating a blog post async function publishBlogPost(slug: string, lang: string) { // ... your publishing logic ...
// Notify search engines await submitUrlToIndexNow(`https://www.bigjson.online/\${lang}/\${slug}\`); }
// Submit common pages after deployment async function afterDeploy() { await submitCommonPages(); } ```
Check if IndexNow is properly configured:
```bash curl https://www.bigjson.online/api/indexnow ```
Or visit: https://www.bigjson.online/api/indexnow in your browser
- After deployment - Submit all pages using
npm run indexnow - When publishing new content - Submit the new URL immediately
- When updating existing content - Submit the updated URL
- Weekly/Monthly maintenance - Resubmit all pages periodically
- Same URL multiple times in a short period (wait at least 24 hours)
- Private/draft content
- Pages you want to keep out of search engines
This implementation submits to three endpoints:
- api.indexnow.org - Central endpoint that distributes to all participating search engines
- bing.com/indexnow - Bing and Microsoft search
- yandex.com/indexnow - Yandex search
- 200 OK - URL successfully submitted
- 202 Accepted - URL received (will be processed later)
- 400 Bad Request - Invalid URL format or missing key
- 403 Forbidden - Key validation failed
- 422 Unprocessable Entity - URL doesn't belong to the host
- 429 Too Many Requests - Rate limit exceeded (wait and retry)
To verify your key file is accessible:
- Visit: https://www.bigjson.online/51c2d562781e4992ab751d34d23f9ab7.txt
- You should see:
51c2d562781e4992ab751d34d23f9ab7
- Don't spam - Only submit when content actually changes
- Batch submissions - Group multiple URLs when possible (more efficient)
- Monitor results - Check the API responses for errors
- Keep the key file - Never delete
51c2d562781e4992ab751d34d23f9ab7.txt - Use after builds - Integrate into your CI/CD pipeline
Add to your deployment script:
```bash
npm run build npm run indexnow ```
Or use Vercel deploy hooks:
```typescript // In your build script or API route if (process.env.VERCEL_ENV === 'production') { await submitCommonPages(); } ```
- Verify file exists at
/public/51c2d562781e4992ab751d34d23f9ab7.txt - Check file contains only the key with no extra spaces/newlines
- Ensure it's accessible at https://www.bigjson.online/51c2d562781e4992ab751d34d23f9ab7.txt
- IndexNow notifies search engines, but doesn't guarantee immediate indexing
- Allow 1-2 weeks for search engines to crawl and index
- Ensure your robots.txt doesn't block search engines
- Check sitemap.xml is properly formatted
- Wait before retrying (typically 24 hours)
- Reduce submission frequency
- Use batch submissions instead of individual ones
For issues specific to this implementation, check:
- API logs: Check your Next.js server logs
- Search engine status: Use Bing Webmaster Tools and Yandex Webmaster
- Test endpoint: GET /api/indexnow