PHP code example of artofwifi / statamic-indexnow

1. Go to this page and download the library: Download artofwifi/statamic-indexnow library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

artofwifi / statamic-indexnow example snippets


return [
    // Your IndexNow API key
    'key' => env('INDEXNOW_KEY'),

    // IndexNow endpoint (any participating engine shares with all others)
    'endpoint' => env('INDEXNOW_ENDPOINT', 'https://api.indexnow.org/indexnow'),

    // Base URL for submitted entries (useful when submitting from a dev environment)
    'production_url' => env('INDEXNOW_PRODUCTION_URL', env('APP_URL')),

    // Automatically submit URLs when entries are published or updated
    'auto_submit' => env('INDEXNOW_AUTO_SUBMIT', false),

    // Collection handles to exclude from the utility and auto-submission
    'exclude_collections' => [],

    // Max URLs per API request (IndexNow protocol limit is 10,000)
    'batch_size' => 10000,
];

'exclude_collections' => ['internal', 'drafts'],

$schedule->command('indexnow:prune')->monthly();
bash
php artisan vendor:publish --tag=statamic-indexnow-config
bash
# Delete records older than 90 days (default)
php artisan indexnow:prune

# Delete records older than 30 days
php artisan indexnow:prune --days=30