承接 hryvinskyi/magento2-seo-robots-frontend 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hryvinskyi/magento2-seo-robots-frontend

Composer 安装命令:

composer require hryvinskyi/magento2-seo-robots-frontend

包简介

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

README 文档

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

统计信息

  • 总下载量: 676
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2021-12-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固