Google Indexing API

We are looking into adding structured data to our job listings to enhance the experience in Google searches. This part is easy enough, but the ideal way to do this involves pushing new/updated/deleted job listing pages directly to the google indexing API so that changes are picked up on faster than the normal sitemap-based methods.

Has anybody done anything like this or have suggestions on where to begin?

Basically I need to ping the API with the precise page URL every time one of the following happens:

  1. New job listing page is added
  2. Job listing page is removed
  3. Job listing page is updated
  4. Only ping after the actual pages are live on my production servers, which happens via a github webhook and git pull.

After reading the first three, I thought using hooks would be the thing to do, but after the forth, no.

Or maybe use hooks to update some file (or a mini Sqlite database) that stores added, removed or updated urls and then use the webhook after deployment to call a script (or a route) that pings the API with the data in this file/database)

As regards posting to the API, you can use the Remote class:

1 Like

Thanks. I was thinking I might have to go the route of creating some sort of file that stores what is current, deleted, and updated. Then maybe I can create something else that triggers via webhook to actually do the ping.

You can store that in any format, maybe a csv file that contains the URL and the status information, or something in JSON format or a database, doesn’t really matter.

Hooks creates a bit of a problem, as these may not necessarily be added via the control panel.

Hm, I see, hooks are are only triggered via the Panel, that’s right. If you do stuff on the file system, it get’s more tricky.

You can of course add the entries manually, or you need some mechanism that checks what has changed between your deployments. Maybe use Git post-commit hooks? I don’t know.

Maybe if you keep a list of job listings in a database, then before you deploy you compare that with your current list, update the database…

If you could use hooks that would definitely be the easiest way.

1 Like