lerni / silverstripe-google-indexing
Google Indexing API integration for Silverstripe CMS – for JobPosting and BroadcastEvent structured data
Package info
github.com/lerni/silverstripe-google-indexing
Type:silverstripe-vendormodule
pkg:composer/lerni/silverstripe-google-indexing
Requires
- google/auth: ^1.0
- silverstripe/framework: ^6
This package is auto-updated.
Last update: 2026-05-25 08:00:40 UTC
README
Google Indexing API integration for Silverstripe CMS.
⚠️ The Google Indexing API is restricted to pages with JobPosting or BroadcastEvent structured data markup. Using it for other content violates Google's Terms of Service and may result in API access revocation.
Requirements
- Silverstripe CMS ^6
google/auth^1.0
Installation
composer require lerni/silverstripe-google-indexing
Google Cloud setup
- Enable the Indexing API in Google Cloud Console
- Create a Service Account and download the JSON key file
- Add the service account email as an owner in Google Search Console for your property
Configuration
Set the service account JSON via environment variable (recommended):
GOOGLE_INDEXING_SERVICE_ACCOUNT_JSON='{"type":"service_account","project_id":"…"}'
Usage
Apply GoogleIndexingExtension only to DataObject classes with JobPosting or BroadcastEvent schema markup:
# app/_config/config.yml App\Models\JobPosting: extensions: - Kraftausdruck\GoogleIndexing\Extensions\GoogleIndexingExtension
The extension auto-detects the owner's versioning:
- Versioned (e.g. SiteTree subclass) → notifies Google on
onAfterPublish/onAfterUnpublish - Non-versioned with UrlifyExtension → notifies Google on
onAfterWrite/onBeforeDelete
Submissions only happen in live environments (Director::isLive()). Nothing is sent in dev or test.
Optional: isPubliclyVisible()
By default, every write/publish triggers URL_UPDATED. If your DataObject has additional visibility conditions beyond its published state (e.g. an Active flag or a ValidThrough expiry date), implement isPubliclyVisible(): bool:
public function isPubliclyVisible(): bool { return (bool) $this->Active && (bool) $this->ValidThrough >= date('Y-m-d'); }
When this method exists, the extension sends URL_DELETED instead of URL_UPDATED whenever it returns false — correctly signalling to Google that the URL is no longer publicly accessible.
Timeout
Default HTTP timeout is 10 seconds. Override via config:
Kraftausdruck\GoogleIndexing\Extensions\GoogleIndexingExtension: timeout: 15
License
BSD-3-Clause © Lukas Erni