Getting your pages indexed on Google sooner

I disovered a cool way to automate getting pages indexed by Google faster.

My blog is fully static, so no moving parts once it’s been generated and thrown on cloudflare pages. However the problem with that is that once a new page or post is generated, I need to wait for google to do their periodic scrape of my sitemap.xml file.

I found a funky new project over @ goenning/google-indexing-script which reads:

Use this script to get your entire site indexed on Google in less than 48 hours. No tricks, no hacks, just a simple script and a Google API.

You can read more about the motivation behind it and how it works in this blog post https://seogets.com/blog/google-indexing-script

It utilizes both NodeJS and a google cloud project + APIs to run. It took about 10 minutes to set up on my personal machine, but I took the time to make this into a github actions workflow file so I can have it run automagically every single time my site is regenerated, here’s the code for that:

name: Google Indexing Script

on:
  workflow_run:
    workflows: ["New Push Actions"]
    types:
      - completed

jobs:
  Nudge-Google-Crawler:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout goenning/google-indexing-script
        run: git clone https://github.com/goenning/google-indexing-script
      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 'latest'
      - name: Get Node version
        run: node --version
      - name: Create service_account.json
        run: |
            echo "${{ secrets.GOOGLE_SERVICEACCOUNT_JSON }}" | base64 --decode > /home/runner/work/blog/blog/google-indexing-script/service_account.json
            sha256sum /home/runner/work/blog/blog/google-indexing-script/service_account.json            
      - name: Run Google Indexing Script
        run: |
          cd /home/runner/work/blog/blog/google-indexing-script
          npm install
          npm run index jonblack.gg          

The secret is just generated string of the service_account.json file converted into base64 via base64 service_account.json

Additionally, I do have an extra action which I haven’t documented which does an API call to cloudflare to wipe the entire cache of this site from their CDN when a new version becomes available, this section below ensures that this workflow won’t activate until that API call workflow (titled “New Push Actions”) successfully completes.

on:
  workflow_run:
    workflows: ["New Push Actions"]
    types:
      - completed

Great stuff.