Looking for an easy way to request Google Search Console to index your website pages?
Here is how a handle the request to index all the 764 pages from https://must-know-resources-for-programmers.giessen.dev/.
- Local project and folder
pnpm init
pnpm add google-indexing-script
- Update the
package.json scripts
"seo": "node index.js"
touch index.js
- add the following to the
index.js
file
import { index } from "google-indexing-script";
import serviceAccount from "./service_account.json" assert { type: "json" };
index("<WEBSITE_URL_HERE>", {
client_email: serviceAccount.client_email,
private_key: serviceAccount.private_key,
quota: {
rpmRetry: true
}
})
.then(console.log)
.catch(console.error);
- Follow the steps in the https://github.com/goenning/google-indexing-script?tab=readme-ov-file#preparation
- Download the credentials JSON https://github.com/goenning/google-indexing-script/issues/2
- Rename the download JSON and move to the folder where the
index.js
is located at - Go to Google Search Console
- Select the Website to index
- Go to settings
- Users and permissions
- Add user
- Add the email from the
<username@project>.iam.gserviceaccount.com
that you created in the step 6 preparations - In the permissions, Select
Owner
- Now you can run the
pnpm seo
in the terminal and that should make the request to index all the pages that are in the sitemap of your website
Top comments (0)