hryvinskyi/magento2-seo-robots-frontend

Frontend implementation for SEO Robots with independent X-Robots-Tag support and directive arrays

Installs: 648

Dependents: 1

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 1

Open Issues: 0

Type:magento2-module

pkg:composer/hryvinskyi/magento2-seo-robots-frontend

2.0.0 2026-01-11 21:55 UTC

This package is not auto-updated.

Last update: 2026-01-11 22:08:36 UTC


README

Frontend module for managing robots meta tags in Magento 2.

Part of hryvinskyi/magento2-seo-robots-pack - Complete SEO Robots solution for Magento 2

Features

  • Apply custom robots meta tags based on URL patterns and actions
  • Support for HTTPS-specific robots settings
  • NOINDEX/NOFOLLOW for 404 pages
  • Custom robots for paginated pages
  • Extension point for custom robots providers

Extension Point

This module provides an extension point that allows other modules to provide custom robots meta tags based on specific conditions.

How to Extend

Implement the RobotsProviderInterface in your module:

<?php

namespace YourVendor\YourModule\Model;

use Hryvinskyi\SeoRobotsFrontend\Model\RobotsProviderInterface;
use Magento\Framework\App\HttpRequestInterface;

class CustomRobotsProvider implements RobotsProviderInterface
{
    /**
     * @inheritDoc
     */
    public function getRobots(HttpRequestInterface $request): ?string
    {
        // Your custom logic here
        // Return robots string like "NOINDEX,NOFOLLOW" or null if not applicable

        if ($someCondition) {
            return 'NOINDEX,NOFOLLOW';
        }

        return null;
    }

    /**
     * @inheritDoc
     */
    public function getSortOrder(): int
    {
        return 100; // Lower numbers execute first
    }
}

Then register your provider in di.xml:

<type name="Hryvinskyi\SeoRobotsFrontend\Model\ApplyRobots">
    <arguments>
        <argument name="robotsProviders" xsi:type="array">
            <item name="your_provider" xsi:type="object">YourVendor\YourModule\Model\CustomRobotsProvider</item>
        </argument>
    </arguments>
</type>

Execution Order

Providers are executed in order of their getSortOrder() value (ascending). If a provider returns a non-null value, it will be applied to the page. Later providers can override earlier ones.

Configuration

Configuration is available in: Stores > Configuration > Hryvinskyi -> SEO > Robots

Dependencies

  • Magento 2.4+
  • Hryvinskyi_SeoRobotsApi

Author

Volodymyr Hryvinskyi volodymyr@hryvinskyi.com

License

Proprietary