3.6 KiB
Indexing Setup & Usage Guide
This guide explains how to fast-track your content indexing on Google and Bing/Yandex using the provided scripts.
[!IMPORTANT] WAIT UNTIL LIVE: Do not run these scripts until your new URLs are live and returning a
200 OKstatus. If you submit a404URL, it may negatively impact your crawling budget or cause errors.
1. Google Indexing API
The Google Indexing API allows you to notify Google when pages are added or removed. It is faster than waiting for the Googlebot to crawl your sitemap.
Prerequisites: service_account.json
To use the script scripts/trigger-indexing.js, you need a Service Account Key from Google Cloud.
- Go to Google Cloud Console: https://console.cloud.google.com/
- Create a Project: (e.g., "QR Master Indexing").
- Enable API: Search for "Web Search Indexing API" and enable it.
- Create Service Account:
- Go to "IAM & Admin" > "Service Accounts".
- Click "Create Service Account".
- Name it (e.g., "indexer").
- Grant it the "Owner" role (simplest for this) or a custom role with Indexing permissions.
- Create Key:
- Click on the newly created service account email.
- Go to "Keys" tab -> "Add Key" -> "Create new key" -> JSON.
- This will download a JSON file.
- Save Key:
- Rename the file to
service_account.json. - Place it in the root of your project (same folder as
package.json). - NOTE: This file is ignored by git for security (
.gitignore), so you must copy it manually if you switch laptops.
- Rename the file to
- Authorize in Search Console:
- Open the JSON file and copy the
client_emailaddress. - Go to Google Search Console property for
qrmaster.net. - Go to "Settings" > "Users and permissions".
- Add User: Paste the service account email and give it "Owner" permission. (This is required for the API to work).
- Open the JSON file and copy the
How to Run
-
Run the script:
npm run trigger:indexing(Or manually:
npx tsx scripts/trigger-indexing.ts) -
The script will automatically fetch ALL active URLs from the project (including tools and blog posts) and submit them to Google. You should see a "Success" message for each URL.
2. IndexNow (Bing, Yandex, etc.)
IndexNow is a protocol used by Bing and others. It's much simpler than Google's API.
Prerequisites: API Key
- Get Key: Go to Bing Webmaster Tools or generate one at indexnow.org.
- Verify Setup:
- The key is typically a long random string (e.g.,
abc123...). - Ensure you have a text file named after the key (e.g.,
abc123....txt) containing the key itself inside yourpublic/folder so it's accessible athttps://www.qrmaster.net/abc123....txt. - Alternatively, set the environment variable in your
.envfile:INDEXNOW_KEY=your_key_here
- The key is typically a long random string (e.g.,
How to Run
This script (scripts/submit-indexnow.ts) automatically gathers all meaningful URLs from your project (tools, blog posts, main pages) and submits them.
-
Run the script:
npm run submit:indexnow(Or manually:
npx tsx scripts/submit-indexnow.ts) -
It will output which URLs were submitted.
Summary Checklist
- New page is published and live.
service_account.jsonis in the project root.- Service Account email is added as Owner in Google Search Console.
- Run
npm run trigger:indexing(for Google). - Run
npm run submit:indexnow(for Bing/Yandex).