gmail user
gmail user

Reputation: 2783

meta tags in asp.net mvc 3

I've website with MVC3 which is not coming up in Google search. As part of SEO optimization, I want to put the meta tags in _layout.cshtml. Is it good to put meta tags only in master page or in the content page as well? What is better technique for SEO? The meta tags are static. Thanks in advance.

Upvotes: 0

Views: 439

Answers (2)

Bohdan
Bohdan

Reputation: 2004

  1. Meta tags which are common to all site should places in _layout.cshtml
  2. Meta tags which describes some custom page should be defines in this page in your custom section.

Example:

_layout.chtml
    <head>
        <title>@Html.Raw(ViewBag.Title)</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    ... other common tags
        @RenderSection("Meta", required: false) // your section
    ...
    </head>

in custom page you should use

@model SomeModel
@section Meta
{
    <meta name="description" content="your custom tag" />
// other custom tags
}
// some html or other code

Upvotes: 2

pollirrata
pollirrata

Reputation: 5286

Since the meta tags are placed on the head, they should be placed only on the layout. You may also want to check the article "SEO is more than meta-tags and good content"

Upvotes: 0

Related Questions