Auto-indexing URLs with IndexNow & GitHub Actions
IndexNow Take Control of Your Website’s Search Engine Visibility
IndexNow is a new protocol that lets you instantly inform search engines about changes to your website. This means your new content can be indexed and appear in search results much faster.
Why is IndexNow a Game-Changer?
- Faster Indexing: Get your new content discovered quicker.
- Prioritized Crawling: Tell search engines which pages are most important.
- Reduced Server Load: Less frequent crawling means less stress on your server.
Improve your website’s visibility and drive more traffic
IndexNow Search engines
The following search engines use IndexNow protocol and provide their API URLs for integration:
IndexNow-enabled search engines instantly share submitted URLs with each other, streamlining indexing across multiple platforms.
Using IndexNow with GitHub Actions: A Step-by-Step Guide
Obtaining an API Key
- Visit the Bing IndexNow website
- Create an account or log in to your existing account
- Once logged in, you’ll be able to generate an API key.
IndexNow GitHub Action Workflow
Create a workflow that triggers on specific events, such as a push to the main branch or a deployment. This workflow will:
- Fetch the IndexNow API key
- Identify changed URLs
- Submit URLs to IndexNow
Set the IndexNow API secret in your repository, go to Settings -> Secrets and Variables -> Actions -> Repository secrets
. Click on New repository secret
paste the key and save it. You can call it INDEXNOW_KEY
.
Create a new Github workflow for sending automatically URLs every day at 11am.
Copy and paste the following code:
name: "IndexNow"
on:
schedule: # Run workflow automatically
‐ cron: "0 11 * * *"
workflow_dispatch:
jobs:
check-and-submit:
runs-on: ubuntu-latest
steps:
‐ name: indexnow-action
uses: bojieyang/indexnow-action@v2
with:
sitemap-location: "https://www.yoursite.com/sitemap.xml"
since: 1
since-unit: "week"
key: ${{ secrets.INDEXNOW_KEY }}
Remember to update sitemap-location
with your correct sitemap URL.
Resources
Tags:
Found a snippet that saved your day? Consider dropping a tip!