Thursday, February 16, 2012

How to add meta tags dynamically in ASP.NET MVC


i was searching for how to show my site Google search as top link site, i came to know that one approach is to add meta tags.
The following steps i have followed for my site :

Step 1 : Adding section for meta in the the main layout under head section

@RenderSection("metas")

Step 2 : Added the following code in the in child page
@section metas
    {
        <meta name="description" content="Hello world" />
        <meta name="title" content="Hello world, Sample program" />
        <meta name="keywords" content="Test1, Test2, Test3" />
    }

Ref :

http://stackoverflow.com/questions/5531271/razor-engine-seo-meta-tags

1 comment: