Developer forum

Forum » Development » SEO friendly pagination

SEO friendly pagination

Jose Caudevilla
Reply

Hi:

 

My website is listing  the product by pagination. Each of these pages are choosen by the query parameter http://mywebsite.com/?PageNum=X

For SEO reasons. We need to change these parameter to http://mywebsite.com/X

I have seen that it can be done implementing a custom UrlDataProvider but i need to use the Ecommerce UrlDataProvider.

 

Is there any way to transform http://mywebsite.com/?PageNum=X to http://mywebsite.com/X?

 

Thanks,

Jose.

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Not out of the box. And really do not waste your time - it will not improve your SEO. Write better content for your product list pages instead.

Anyways - you can probably create a rewrite rule for IIS in web.config: https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

Alternatively, create a custom Dynamicweb URLProvider and enable it in settings:

 

using System.Collections.Generic;
using Dynamicweb.Core;
using Dynamicweb.Data;
using Dynamicweb.Extensibility.AddIns;
namespace Dynamicweb.Frontend.UrlProviders
{

    [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
    [System.ComponentModel.Browsable(false)]
    [AddInName("Paging URL Provider")]
    [AddInDescription("Generates urls pagenum=X and change them to /pageX")]
    [AddInActive(true)]
    [AddInGroup("Paging")]
    [AddInTarget("Paging")]
    [AddInOrder(10)]
    public class NewsItemProvider : UrlProvider
    {
        /// <summary>
        /// Gets the mappings of NewdIDs and their URL names.
        /// </summary>
        /// <returns></returns>
        public override List<Mapping> GetMappings()
        {
            // Placeholder for holding mappings
            var list = new List<Mapping>();

            for(var i  = 0; i < 100; i++) {
                list.Add(new Mapping("PageNum", i.ToString(), $"page{i}"));
             }

            return list;
        }
    }
}
Votes for this answer: 1
 
Jose Caudevilla
Reply

Hi nicolai:

 

A lot of thanks for your answer 

 

We will talk with our client to advise him.

 

Regards,

 

Jose

 

You must be logged in to post in the forum