8000 GitHub - mage2sk/module-index-now · GitHub
Skip to content

Repository files navigation

Magento 2 IndexNow

Notifies search engines that support the IndexNow protocol (Bing, Yandex and the other participating engines) as soon as a product, category or CMS page is saved in the admin, so the changed URL is picked up without waiting for a crawl. The module submits the URLs to the shared IndexNow endpoint and serves the verification key file the protocol requires.

It is for store owners who want content changes reflected quickly in IndexNow-participating engines. Google does not use IndexNow; nothing is submitted there. The module has no storefront output, so it works with any theme.

Product page: kishansavaliya.com/magento-2-index-now.html

Features

  • Submits the URL of a product, category or CMS page to IndexNow when it is saved in the admin.
  • URLs saved during one request are collected and sent once at the end of that request, in batches of up to 10,000 URLs.
  • Serves the IndexNow key at /panth_indexnow/key on the storefront (plain text, noindex, not cached), with a 404 when the module is disabled or no key is set.
  • API key and enable switch per store view, so each store view can use its own key.
  • Failures are logged to Magento's log files and never interrupt the save.
  • No database tables, no cron jobs and no console commands.

Compatibility

Magento Open Source / Adobe Commerce 2.4.4 to 2.4.8
PHP 8.1, 8.2, 8.3, 8.4
Themes Any (no storefront output)

The Composer package requires magento/framework ^103.0, magento/module-store ^101.1, magento/module-catalog ^104.0, magento/module-cms ^104.0 and magento/module-config ^101.2.

Requirements

  • Magento 2.4.4 or later
  • PHP 8.1 to 8.4
  • mage2kishan/module-core (installed automatically by Composer; provides the shared "Panth Extensions" admin tab)
  • Outbound HTTPS access from the web server to api.indexnow.org
  • An IndexNow key: a string of 8 to 128 hexadecimal characters. Bing offers a generator at bing.com/indexnow; any string in that format works.

Installation

composer require mage2kishan/module-index-now
bin/magento module:enable Panth_Core Panth_IndexNow
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

setup:di:compile is only needed in production mode. The module has no static assets.

Check the result with:

bin/magento module:status Panth_IndexNow

The module is switched off by default. Enter a key and enable it in the configuration, then open /panth_indexnow/key on your store's domain and confirm the key is returned.

Configuration

Go to Stores > Configuration > Panth Extensions > IndexNow.

Setting Default What it does
Enable IndexNow No Submits changed URLs on save and serves the key file.
API Key (empty) Your IndexNow key. Also used to answer the key file request.

Both settings can be set per default, website or store view. Configuration paths: panth_index_now/indexnow/enabled, panth_index_now/indexnow/api_key.

Admin configuration

Usage

  • Saving a product, a category or a CMS page in the admin queues its storefront URL for the store view the entity was saved in. At the end of the request the queued URLs are posted as one JSON request to the IndexNow endpoint at api.indexnow.org/IndexNow with the store host, the key and the key location. IndexNow shares submissions with all participating engines, so one submission is enough.
  • The key location sent is <store base URL>/panth_indexnow/key. The same controller also answers /panth_indexnow/key?key=<key> (a .txt suffix on the key is accepted), returning the key only when it matches the configured one.
  • Deletions are not submitted. Products saved without a store scope use the URL of the store view they were saved in.
  • Results are written to Magento's log: successful submissions as info entries, unexpected HTTP responses and connection errors as warnings or errors. A 15 second request timeout keeps admin saves responsive if the endpoint is slow.

Developer Notes

  • Module name: Panth_IndexNow
  • Composer package: mage2kishan/module-index-now
  • PHP namespace: Panth\IndexNow
  • Observer Panth\IndexNow\Observer\IndexNow\EntityChangeObserver on catalog_product_save_after, catalog_category_save_after and cms_page_save_after; submission through Panth\IndexNow\Model\IndexNow\Submitter::submit(array $urls, int $storeId).
  • Frontend route panth_indexnow, controller Panth\IndexNow\Controller\Key\Index.
  • Upgrade from Panth Advanced SEO: the data patch MigrateConfigPaths moves saved values from panth_seo/indexnow/* to panth_index_now/indexnow/* during setup:upgrade.
  • ACL resource for the configuration section: Panth_IndexNow::config

Uninstallation

bin/magento module:disable Panth_IndexNow
composer remove mage2kishan/module-index-now
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

The module creates no database tables. Its configuration values remain in core_config_data until removed.

Support

License

Proprietary, as declared in composer.json. The package is published on Packagist and can be installed with Composer; see the product page for the terms of use.

Changelog

See CHANGELOG.md.

Links

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0