Improving SEO With ASP.Net MVC – Part 1 – Creating Better SEO URLs

 Improving SEO With ASP.Net MVC – Part 3 – Google Search Features

The Problem

Having correct SEO tags for meta description, meta keywords, meta title and canonical are very important when it comes to the overall SEO health of your website. Without these tags you are relying on Google and Bing to determine what to show users in search results for your website. Canoncial URLs also implicitly tell search engine what the URL for the page should be. This is extremely handy when you use querystring parameters which change the URL but not necessarily the content on the page.

The Solution

Step 1 – Update Your _Layout.Cshtml To Create Dynamic Tags For The Following: Title, Meta Description, Meta Keywords And Canoncial.

In the <head></head> insert the following.

<title>@ViewBag.Title</title>
<meta name="description" content="@ViewBag.MetaDescription">
<meta name="keywords" content="@ViewBag.MetaKeywords">
<link rel="canonical" href="@ViewBag.CanonicalURL" />

This is an example from the top of my index.cshtml which renders our home page.

@{
    ViewBag.Title = "Mobilize Cloud - Columbus Web Development Agency";
    ViewBag.MetaDescription = "We are one of Columbus, Ohio's top web development agencies. With a focus on custom web applications, digital marketing, SEO/SEM and more we build solutions to solve your business problems. Our services include: Websites, Web Applications, E-Commerce, The Cloud, Social Media, Search Engine Optimization(SEO) and Digital Marketing. Columbus Web Development.";
    ViewBag.MetaKeywords = "Columbus Web Development, Mobilize Cloud, MobilizeCloud, Mobilize, Mobilize Web Development, Columbus Ohio Web, Columbus Ohio Web Development, Web Development Columbus, Web Development Ohio, Columbus Website, Ohio Website, TopCME, OSU CCME, Custom Web Development, Responsive Web Development, Columbus SEO, Columbus Search Engine Optimization";
    ViewBag.CanonicalURL = "https://www.mobilizecloud.com";
}
Step 2 – Now You Can Add Dynamic ViewBag Properties In Each Of Your Views Or Controllers.
Step 3 – Dynamic Content

Instead of declaring these properties in your view you can assign them at the controller level stripping out keywords from content you may have stored in your model.

This example using a custom library we created call KeywordAnalyzer that can find the top keywords from body copy. We first strip any html tags so they are not included as keywords.

We are also incorporating the BlogPost.Title into the title of the page. We will post our KeywordAnalyzer library to github and provide a link soon.

var KeywordAnalyzer = new KeywordAnalyzer();
ViewBag.Title = BlogPost.Title + " | Mobilize Cloud - Columbus Web Development";
ViewBag.MetaKeywords = string.Join(", ", KeywordAnalyzer.Analyze(StringFunctions.StripHTML(BlogPost.Body)).Keywords.OrderBy(k => k.Rank).Select(k => k.Word));
ViewBag.MetaDescription = BlogPost.Summary;