Feature: Robots URL Rules

オープン
#88 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@GeekInTheNorth がすでに取り組んでいます。

2026年6月26日 から。

評価

この issue はまだ評価されていません。

説明

CMS13 enhancement In Progress

Feature: Robots URL Rules

Background

As a website owner, I want to configure rules that are triggered by the presence of specific query string parameters or by partial URL match so that I can alter search engine behaviour for URL variants without requiring a code deployment.

Many websites expose multiple variations of the same page through query string parameters. Whilst these URLs may be useful to visitors, they are often undesirable for search engine indexing as they can result in duplicate content and unnecessary crawl budget consumption.

Users of the External Reviews Addon can generate an external review link for an unpublished version of a page. This URL is generated as https://www.example.com/externalcontentview/<guid> where is a randomly generated GUID. If that page version is part of a Project, then all links on that page are automatically appended with /externalcontentview/<guid>/preview_generated=true. If a content editor accidentally cuts and pastes such a link into their published content, search engine crawlers will then index all those content pages with their obfuscated URLs which is undesirable for SEO. This is a perfect example of where you want to override the robots meta tag and header to prevent indexing of those pages.

Examples include:

/listing-page/?category=123&page=1
/listing-page/?preview=true
/listing-page/?print=true
/listing-page/?sort=name
/listing-page/?view=grid
/externalcontentview/<guid>
/en/some-page/externalContentView?preview_generated=true

whereas URLs such as:

/listing-page/?page=1

may still be considered valid for indexing.

Rather than requiring developers to implement custom logic, administrators should be able to configure query string rules within Stott Robots Handler.


User Story

As a CMS Administrator

I want to configure Query String and URL Rules that execute configurable actions when specific query string parameters are present or URL matches exist

So that I can control how search engines interact with specific URL variants without requiring an application deployment.


Acceptance Criteria

Scenario 1 - Matching Query String

Given a query string rule is enabled
And the request contains a configured query string parameter
When the page is requested
Then the configured actions are executed.


Scenario 2 - No Matching Query String

Given a query string rule is enabled
And the request does not contain a configured query string parameter
When the page is requested
Then no actions are executed
And existing Robots Handler behaviour remains unchanged.


Scenario 3 - URL Matches

Given a URL match rule is enabled
And the request URL matches the defined rule
When the page is requested
Then the configured actions are executed.


Scenario 4 - No URL Matches

Given a URL match rule is enabled
And the request URL does not match any rules
When the page is requested
Then no actions are executed
And existing Robots Handler behaviour remains unchanged.


Scenario 5 - Rules Disabled

Given Robots URL Rules are disabled
When any page is requested
Then existing Robots Handler behaviour remains unchanged.


Scenario 6 - Robots Override Action

Given a Rule contains the Override Robots action
When the request matches the rule
Then the configured robots directives are applied to the Robots meta tag
And the configured robots directives are applied to the X-Robots-Tag response header.


Scenario 7 - Link Processing Action

Given a Rule contains the Add rel="nofollow" to qualifying links action
And an <a> element is rendered
And the destination URL contains a configured query string parameter
Then the rendered link contains a rel="nofollow" attribute.


Example Rules

Parameter Value Directive
page * noindex,follow
preview * noindex,nofollow
print true noindex,follow
search * noindex,follow

Configuration

Add a new administration screen named Robots URL Rules.

Global Settings

  • Enable / Disable Robots URL Rules

Rules

Administrators can:

  • Create rules
  • Edit rules
  • Delete rules
  • Enable / Disable rules
  • Reorder rule priority

Each rule contains:

General
  • Name
  • Enabled
Matching
  • One Query String Parameter Name
    • Parameter names only (no '=' or values)
    • Validation to ensure valid parameter names
    • At least one parameter is required
  • One URL Match
Actions

A rule can execute one or more actions.

Override Robots

When enabled:

  • Override the Robots meta tag
  • Override the X-Robots-Tag response header

Administrators can configure:

  • No Index
  • No Follow
Add rel="nofollow" to Qualifying Links

When enabled:

  • Any generated <a> element whose destination contains a matching query string parameter will automatically receive a nofollow relationship.

Processing Order

The existing robots override pipeline becomes:

  1. Robots URL Rules
  2. Environment Robots Override
  3. Page-specific Robots configuration
  4. Default behaviour

This ensures rules can be tested in lower environments when environmental locks are in place.


Implementation Notes

Storage

  • Store configuration in DDS.
  • Continue to use the existing Repository / Service pattern.
  • Cache configuration to minimise DDS lookups.

MetaRobotsTagHelper

Existing:

  • If an Environment Robots Override exists, return the configured environment directives.

New:

  • If a matching Query String Rule contains the Override Robots action, return the configured robots directives.

Existing:

  • If no robots directives are configured, remove the meta tag.

RobotsHeaderMiddleware

Existing:

  • If an Environment Robots Override exists, return the configured X-Robots-Tag.

New:

  • If a matching Query String Rule contains the Override Robots action, return the configured X-Robots-Tag.

Link Processing

When rendering links:

  • Detect whether the destination URL contains a configured query string parameter.

  • If a matching Query String Rule contains the Add rel="nofollow" action:

    • Add nofollow to the rel attribute.
    • Preserve any existing rel values.
    • Do not add duplicate values.

Version 1 Scope

The initial release supports matching on:

  • Presence of one or more query string parameter names.

Future enhancements may include:

  • Parameter value matching
  • Wildcard parameter names (e.g. utm_*)
  • Regular expression matching
  • Additional actions beyond robots handling

The underlying design should therefore separate matching from actions, allowing new actions to be introduced without redesigning the feature.

主要言語
C#
スター
3
フォーク
5
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GeekInTheNorth/Stott.Optimizely.RobotsHandler のほかの issue

GeekInTheNorth/Stott.Optimizely.RobotsHandler の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。