Skip to main content

SEO Paging

  • 2 minutes to read

This topic describes the concept of SEO-friendly paging.

Overview

Callback-aware grid components render pager items as buttons that respond to user clicks to raise data update callbacks, which is why search engines ignore grid pages. When indexing a site, search engines use the information contained within the first page.

The DevExpress ASP.NET MVC GridView extension allows you to create an SEO-friendly pager. Use the ASPxGridPagerSettings.SEOFriendly (via GridViewSettings.SettingsPager.SEOFriendly) property for this purpose. If this property is set to SEOFriendlyMode.CrawlerOnly, the GridView extension renders hyperlinks in the pager when a web-crawler is detected. For other visitors, standard pager items are generated. Thus, search engines can index the entire content of the grid, and site visitors experience the same callback functionality. If the property is set to SEOFriendlyMode.Enabled or SEOFriendlyMode.Disabled, the automatic web crawler detection is disabled. The pager renders either SEO-friendly or standard links, respectively.

To see the SEO-friendly paging feature in action, refer to the GridView - SEO Friendly Paging demo.

SEO-Friendly Paging Limitations

If the ASPxGridPagerSettings.SEOFriendly (via GridViewSettings.SettingsPager.SEOFriendly) property is set to SEOFriendlyMode.Enabled, each pager button link refers to a unique address. In this case, clicking a pager link does not post back to the same page, but generates a completely new request. As a result, a totally new page is created on the server, and information about the previous page state is lost. By design, in this mode, only information about the sorting, grouping and page size applied to the GridView extension is preserved using specific request parameters. Other grid states (such as applied filter criteria, column order, row selection, row expansion states, etc.) are not preserved. Thus, to keep grid appearance consistent and grid content relevant for all pages, it is recommended that you enable the SEO mode only for grids that use minimal functional features, such as sorting and/or grouping.

Example

The code sample below demonstrates how to enable SEO-friendly paging for the GridView. Note that enabling SEO-friendly paging does not require editing route collection or attribute routes.

Partial View code:

@Html.DevExpress().GridView(settings =>
{
    settings.Name = "MyGridView";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartial" };

    settings.KeyFieldName = "CustomerID";
    settings.Columns.Add("ContactName");
    settings.Columns.Add("CompanyName");
    settings.Columns.Add("City");
    settings.Columns.Add("Region");
    settings.Columns.Add("Country");
    // ...    
    settings.SettingsPager.PageSize = 5;
    settings.SettingsPager.PageSizeItemSettings.Visible = true;
    // Enable SEO friendly paging
    settings.SettingsPager.SEOFriendly = DevExpress.Web.SEOFriendlyMode.Enabled;
}).Bind(Model).GetHtml()

The image below illustrates the result.

MVC_Grid_FN_Paging_SeoFriendly