bing_indexing_api
Precondition
From Bing documentation:
Bing recommends using the URL submission tool to get web content indexed (as soon as it is published) or updated online. As a webmaster, you can submit URLs to Bing programmatically through the Submit URLs API or the URL submission feature in Bing Webmasters Tools. It allows you to submit up to 10,000 URLs per day for most sites, for (potential) immediate crawls and indexation – depending on a variety of signals available to Bing. We reset the quota every day at midnight GMT. It is also recommended to refresh Sitemaps at least once a day to help Bing discover all relevant (fresh and non-fresh) URLs of your website.
What does the module do?
The module provides Bing Submission Tool API solution that allows websites to notify Bing whenever website contents is updated or created allowing instant crawling, indexing and discovery of your site content.
See URL Submission Tool for more details.
How to use?
- Install the module via Composer.
- Get API credentials. Follow the instructions to configure Bing and obtain an API key: Getting Access to Bing API.
- Add credentials to /admin/config/services/bing-index-api.
- Provide your domain URL (e.g., 'https://example.com') and the API keys obtained in the previous step to connect with the Microsoft Bing Indexing API.
- (Optional) Add settings for when to trigger URL submission.
Note: This feature works for nodes only. Make a feature request if needed.
Example of Developer Usage:
Trigger reindexing for a single URL:
\Drupal::service('bing_indexing_api.client')->reindexUrl('https://example.com/foo/boo');
Trigger reindexing for multiple URLs:
\Drupal::service('bing_indexing_api.client')->reindexUrl([
'https://example.com/foo/boo',
'https://example.com/foo/moo'
]);
How to Test
- Submit some URLs using the Bulk Form.
- Check Microsoft Bing | Webmaster Tools.
If everything is correct, the submitted URLs will appear in the "Submitted URLs" list.
Note: use path aliases, /node/1 and /node-1-path-alias are different urls for Bing.