Using wildcards in metadata for better SEO

   —   
The following article shows how to use wildcards URLs in the metadata of the pages so that every page has a unique identifier and therefore looks better and has improved SEO.
The following article shows how to use wildcards URLs in the metadata of the pages so that every page has a unique identifier and therefore looks better and has improved SEO.

When you are using wildcard URLs, the page title is usually static which is not the best solution. Lets see an example. In our default community website template the wildcards are used for members so you can access the member’s profile by entering  url such as "Members/Abi.aspx" to get the correct profile. However the page title (or any other field) and some webparts (breadcrumbs) do not reflect  the  user name. It has usually some static text such as "profile". This article will show you how to change it to a dynamic value so the page title would be the name of the user.
There are 3 options of how to achieve it:

First option
Using a query string macro: { % UserName % }

Second option
Getting query string through context macro:
{ % QueryString.GetValue("UserName") # % }

Third option
Create your own custom macro. You can use this method when you want to add special logic to your macro.

1)    Creating custom macro as it is described at devnet.kentico.com/docs/devguide/index.html?types_of_macros.htm
2)    Creating macro definition:
case "seourl": e.Match = true; string url = HttpContext.Current.Request.QueryString["UserName"]; e.Result = url; url = "Special user " + url; break;

3)    Using the macro in the metadata like: { #seourl# }

In your case you would need to change the request for query string from "UserName" to the wildcard value you are using. So if you are using wildcard url {Company} you would alter the macro: QueryString["Company"];
-rs-


Applies to: Kentico CMS 7.x
Share this article on   LinkedIn