---
title: "SeoEngine for filter the link?"  
description: "Yes — you absolutely CAN create a small “SEO indexability engine” 👍"  
author: "Ravi Vishwakarma"  
published: 2025-12-18  
updated: 2025-12-19  
canonical: https://answers.mindstick.com/blog/9/seoengine-for-filter-the-link  
category: "technology"  
tags: ["seo", "tech"]  
reading_time: 3 minutes  

---

# SeoEngine for filter the link?

**You absolutely CAN create a small “[SEO](https://www.mindstick.com/services/search-engine-optimization) indexability engine”.** And for your use case (`?page=2` indexable, `?sort=hhh` not indexable), this is actually the **best long-term solution**.

Below is a **clean, [production](https://www.mindstick.com/news/2276/by-the-end-of-2023-tesla-cybertruck-mass-production-will-begin)-ready** [**SEO engine**](https://www.mindstick.com/articles/339024/seo-and-web-design-how-to-make-your-site-search-engine-friendly) for [**ASP.NET MVC**](https://www.mindstick.com/category/article/asp-dot-net-mvc) **5**.

## What this SEO Engine Will Do

- Decide **indexable vs non-indexable**
- Handle **[pagination](https://www.mindstick.com/blog/265/pagination-in-php), sort, filter, search params**
- Generate [**canonical URL**](https://www.mindstick.com/blog/305064/what-is-a-canonical-url-how-to-fix-canonical-issue)
- Control **meta robots automatically**
- Centralized (no duplicate logic in views)

![SeoEngine for filter the link?](https://answers.mindstick.com/blogs/baa3e8d2-7da0-49db-b031-98b2a1d4329f/images/6fc15426-0186-4f5d-960d-3cdd45f4536e.png)

## SEO RULE ENGINE (Concept)

| Parameter | Behavior |
| --- | --- |
| `page` | indexable |
| `sort` | noindex |
| `filter` | noindex |
| `search` | noindex |

## SEO Decision Model

```cs
public class SeoResult
{
    public bool IsIndexable { get; set; }
    public string CanonicalUrl { get; set; }
}
```

## SEO Engine (Core Logic)

```cs
public static class SeoEngine
{
    private static readonly HashSet<string> NonIndexableParams =
        new HashSet<string>(StringComparer.OrdinalIgnoreCase)
        {
            "sort",
            "filter",
            "search",
            "utm_source",
            "utm_medium"
        };

    public static SeoResult Evaluate(HttpRequestBase request)
    {
        var query = request.QueryString;
        bool hasNonIndexableParam = false;

        foreach (string key in query.Keys)
        {
            if (key == null) continue;

            if (NonIndexableParams.Contains(key))
                hasNonIndexableParam = true;
        }

        var baseUrl = request.Url.GetLeftPart(UriPartial.Path);

        return new SeoResult
        {
            IsIndexable = !hasNonIndexableParam,
            CanonicalUrl = baseUrl
        };
    }
}
```

- Works in ASP.NET MVC 5
- Clean extension syntax
- No breaking changes

## Extension Method for `HtmlHelper`

```cs
public static class SeoEngineExtensions
{
    public static SeoResult Evaluate(this HtmlHelper htmlHelper)
    {
        var request = htmlHelper.ViewContext.HttpContext.Request;
        return SeoEngine.Evaluate(request);
    }
}
```

## Use Engine in Controller

```cs
public ActionResult Index(int page = 1, string sort = null)
{
    var seo = SeoEngine.Evaluate(Request);

    ViewBag.CanonicalUrl = seo.CanonicalUrl;
    ViewBag.NoIndex = !seo.IsIndexable;

    ViewBag.Page = page;

    return View();
}
```

## Layout (`_Layout.cshtml`)

```cs
<link rel="canonical" href="@ViewBag.CanonicalUrl" />

@if (ViewBag.NoIndex == true)
{
    <meta name="robots" content="noindex, follow" />
}
else
{
    <meta name="robots" content="index, follow" />
}
```

## What This Engine Achieves

| URL | Canonical | Indexable |
| --- | --- | --- |
| `/articles` | `/articles` | indexable |
| `/articles?page=2` | `/articles?page=2` | indexable |
| `/articles?sort=asc` | `/articles` | noindexable |
| `/articles?sort=asc&page=2` | `/articles?page=2` | noindexable |
| `/articles?utm_source=fb` | `/articles` | noindexable |

- Google-safe
- No duplicate content
- Crawl budget preserved

## Why This Is the RIGHT Approach

- Centralized SEO logic
- Easy to extend
- No fragile Razor conditions
- Works with pagination, filters, tracking params
- Matches **Google [best practices](https://www.mindstick.com/blog/304770/how-to-create-responsive-designs-tips-and-best-practices)**

## Also Read

1. [How to implement WebSocket in .net for chats?](https://answers.mindstick.com/blog/8/how-to-implement-websocket-in-dot-net-for-chats)
2. [Now Essential Why E-E-A-T Optimization Is for Top Google Rankings](https://answers.mindstick.com/blog/3/now-essential-why-e-e-a-t-optimization-is-for-top-google-rankings)
3. [How to Implement ChatGPT in a Website (Complete Guide)](https://answers.mindstick.com/blog/1/how-to-implement-chatgpt-in-a-website-complete-guide)

---

Original Source: https://answers.mindstick.com/blog/9/seoengine-for-filter-the-link

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
