eZeeNow.com

it's your's

How to add meta tags dynamically in MVC (How to include SEO information such as meta keywords and descriptions)?

There are many ways we can include SEO/Meta tags/Keywords dynamically in razor/aspx pages.

Easiest way is to use a section and render that section in page level.

<!DOCTYPE html>
<html>
<head>
@RenderSection("MetaContent", required: false)
</head>
<body>

@{
Layout = "~/Views/Shared/_Layout.cshtml";
}

@section MetaContent{
<meta name="description" content="Mydescript">
<meta name="Keywords" content="insurance,diet,weight loss">
}

<div>The main content</div>

Method 2 is pretty much static and hard coded.

You need to write at the controller level using OnExecutingAction and ViewData  Methods

protected override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        var keywords = filterContext.ActionDescriptor.GetCustomAttributes(typeof(MetaKeywordsAttribute), false);
        if (keywords.Length == 1)
            ViewData["MetaKeywords"] = keywords.Value;

        var description = filterContext.ActionDescriptor.GetCustomAttributes(typeof(MetaDescriptionAttribute), false);
        if (description.Length == 1)
            ViewData["MetaDescription"] = description.Value;

        base.OnActionExecuting(filterContext);
    }
In Controller something like

[MetaKeywords("THis is meta keywords")]
[MetaDescription("This is meta description")]
ActionResult Hello()
{
return View();
}

Comments (68) -

  • health

    9/7/2016 8:51:45 AM | Reply

    great put up, very informative. I ponder why the other specialists of this sector do not notice this. You must proceed your writing. I'm confident, you have a huge readers' base already!

  • Health &amp; Fitness

    9/12/2016 8:39:55 PM | Reply

    Wow, incredible blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is magnificent, as well as the content!

  • Health &amp; Fitness

    9/12/2016 8:39:55 PM | Reply

    Definitely, what a magnificent blog and illuminating posts, I will bookmark your site.Have an awsome day!

  • Health &amp; Fitness

    9/12/2016 8:39:55 PM | Reply

    Great website! I am loving it!! Will come back again. I am taking your feeds also

  • Health &amp; Fitness

    9/12/2016 8:39:55 PM | Reply

    Whats Going down i am new to this, I stumbled upon this I've discovered It positively useful and it has helped me out loads. I hope to contribute & assist other users like its aided me. Good job.

  • Health &amp; Fitness

    9/12/2016 8:39:55 PM | Reply

    Hello.This post was extremely motivating, particularly since I was browsing for thoughts on this matter last Thursday.

  • fitness

    9/20/2016 8:30:11 PM | Reply

    Thanks a lot for providing individuals with an extremely superb possiblity to read articles and blog posts from this site. It really is very pleasing and also stuffed with amusement for me and my office fellow workers to visit your site not less than three times in 7 days to read the newest tips you have got. And definitely, I am also usually satisfied considering the brilliant suggestions you give. Some 2 tips in this article are essentially the most efficient we've had.

  • Cool Cheap Gadgets

    10/10/2016 2:34:34 AM | Reply

    Great write-up, I¡¦m regular visitor of one¡¦s blog, maintain up the excellent operate, and It's going to be a regular visitor for a lengthy time.

  • Career Test

    10/10/2016 2:34:41 AM | Reply

    Thank you for some other magnificent post. The place else could anybody get that type of information in such an ideal means of writing? I have a presentation next week, and I'm on the look for such information.

  • Graphic Design Jobs

    10/10/2016 2:34:41 AM | Reply

    As I web site possessor I believe the content material here is rattling magnificent , appreciate it for your hard work. You should keep it up forever! Good Luck.

  • Home Improvement Stores

    10/10/2016 2:34:42 AM | Reply

    wonderful publish, very informative. I wonder why the opposite specialists of this sector don't notice this. You should proceed your writing. I am sure, you have a great readers' base already!

  • Payday Loans

    10/10/2016 2:34:42 AM | Reply

    It¡¦s actually a cool and useful piece of information. I¡¦m glad that you shared this helpful info with us. Please stay us informed like this. Thanks for sharing.

  • Dogs For Adoption

    10/10/2016 2:34:43 AM | Reply

    Thank you for every other informative website. The place else could I get that type of information written in such a perfect approach? I've a project that I am simply now running on, and I have been on the look out for such info.

  • Online Shopping

    10/10/2016 2:34:45 AM | Reply

    I relish, cause I found exactly what I used to be having a look for. You have ended my 4 day lengthy hunt! God Bless you man. Have a great day. Bye

  • Home Improvement Stores

    10/10/2016 5:23:32 AM | Reply

    I was just seeking this information for a while. After 6 hours of continuous Googleing, finally I got it in your site. I wonder what's the lack of Google strategy that don't rank this type of informative websites in top of the list. Generally the top websites are full of garbage.

  • Puppies

    10/10/2016 5:23:40 AM | Reply

    Thanks so much for providing individuals with such a splendid chance to read in detail from this website. It's usually very nice plus stuffed with a good time for me and my office acquaintances to visit your blog the equivalent of thrice a week to find out the new secrets you will have. And definitely, I'm usually satisfied with your astonishing tactics served by you. Certain 4 areas in this posting are absolutely the finest we've had.

  • Department Of Finance

    10/10/2016 5:23:51 AM | Reply

    This is really interesting, You're a very skilled blogger. I have joined your rss feed and look forward to seeking more of your wonderful post. Also, I have shared your web site in my social networks!

  • Buying Time

    10/10/2016 5:23:53 AM | Reply

    Hello, Neat post. There's an issue together with your web site in web explorer, might test this¡K IE nonetheless is the market leader and a large component of other people will miss your great writing because of this problem.

  • Food

    10/11/2016 6:42:49 AM | Reply

    You could definitely see your enthusiasm in the work you write. The world hopes for more passionate writers like you who are not afraid to mention how they believe. Always follow your heart.

  • Computer &amp; Internet

    10/11/2016 6:42:54 AM | Reply

    Super-Duper website! I am loving it!! Will come back again. I am taking your feeds also

  • Arts

    10/11/2016 6:42:55 AM | Reply

    I'm really impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you modify it yourself? Anyway keep up the nice quality writing, it is rare to see a great blog like this one these days..

  • Health &amp; Society

    10/11/2016 6:42:55 AM | Reply

    Well I really enjoyed reading it. This information offered by you is very useful for correct planning.

  • Recreation

    10/11/2016 6:43:01 AM | Reply

    Thank you for another magnificent article. Where else could anybody get that type of info in such a perfect approach of writing? I have a presentation next week, and I am on the search for such information.

  • Games

    10/11/2016 6:43:35 AM | Reply

    Magnificent beat ! I would like to apprentice while you amend your website, how could i subscribe for a blog site? The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear concept

  • Home Improvement Kitchen

    10/11/2016 6:44:56 AM | Reply

    you're actually a just right webmaster. The website loading velocity is incredible. It seems that you're doing any distinctive trick. In addition, The contents are masterwork. you have done a magnificent job in this subject!

  • Games Online

    10/11/2016 6:45:12 AM | Reply

    I am continually searching online for ideas that can help me. Thank you!

  • Business

    10/12/2016 3:23:57 AM | Reply

    Fantastic site. A lot of helpful information here. I¡¦m sending it to some friends ans also sharing in delicious. And of course, thank you to your sweat!

  • Games

    10/12/2016 3:24:08 AM | Reply

    I am writing to make you know what a magnificent discovery my friend's girl encountered viewing yuor web blog. She learned a wide variety of details, not to mention how it is like to possess a wonderful helping mindset to have a number of people without hassle fully grasp chosen specialized subject matter. You actually surpassed my expectations. I appreciate you for providing the practical, healthy, explanatory and even fun tips about this topic to Emily.

  • House &amp; Home Improvement

    10/12/2016 3:24:11 AM | Reply

    I think this is among the most significant info for me. And i'm glad reading your article. But should remark on some general things, The website style is wonderful, the articles is really excellent : D. Good job, cheers

  • Business

    10/12/2016 3:24:13 AM | Reply

    I¡¦ve recently started a site, the info you provide on this site has helped me tremendously. Thanks  for all of your time & work.

  • Relationship

    10/12/2016 3:24:14 AM | Reply

    wonderful issues altogether, you simply gained a new reader. What might you suggest in regards to your publish that you just made some days ago? Any positive?

  • Business

    10/12/2016 3:24:32 AM | Reply

    Thank you for all your effort on this blog. Debby enjoys going through investigation and it's easy to see why. Most of us notice all concerning the compelling medium you give helpful tips via the web site and as well as encourage response from website visitors on the area so our own simple princess is really discovering a lot of things. Take pleasure in the remaining portion of the new year. You are conducting a stunning job.

  • Business

    10/12/2016 3:31:25 AM | Reply

    I have been absent for a while, but now I remember why I used to love this website. Thank you, I will try and check back more often. How frequently you update your site?

  • Business

    10/14/2016 3:28:25 AM | Reply

    I like what you guys are up also. Such clever work and reporting! Keep up the superb works guys I have incorporated you guys to my blogroll. I think it'll improve the value of my web site Smile

  • Computer &amp; Internet

    10/14/2016 3:28:39 AM | Reply

    Great awesome things here. I am very happy to see your post. Thank you a lot and i am taking a look ahead to touch you. Will you kindly drop me a mail?

  • Games

    10/14/2016 3:28:39 AM | Reply

    Keep functioning ,great job!

  • Business

    10/14/2016 3:32:21 AM | Reply

    Great remarkable issues here. I¡¦m very satisfied to peer your article. Thank you so much and i am looking ahead to contact you. Will you kindly drop me a mail?

  • Recreation

    10/15/2016 2:54:11 AM | Reply

    You really make it seem so easy with your presentation but I find this matter to be actually something which I think I would never understand. It seems too complicated and extremely broad for me. I'm looking forward for your next post, I will try to get the hang of it!

  • Arts

    10/15/2016 2:54:11 AM | Reply

    Hello.This article was extremely remarkable, especially since I was looking for thoughts on this subject last Wednesday.

  • Arts

    10/15/2016 2:54:18 AM | Reply

    Undeniably believe that which you said. Your favorite justification seemed to be on the net the simplest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they plainly don't know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks

  • Arts

    10/15/2016 2:54:18 AM | Reply

    fantastic issues altogether, you just gained a new reader. What might you recommend about your submit that you just made a few days ago? Any sure?

  • Home Improvement Kitchen

    10/15/2016 2:54:25 AM | Reply

    This is very interesting, You are a very skilled blogger. I have joined your feed and look forward to seeking more of your magnificent post. Also, I've shared your website in my social networks!

  • Recreation

    10/15/2016 2:54:31 AM | Reply

    I like what you guys are up too. Such intelligent work and reporting! Carry on the excellent works guys I have incorporated you guys to my blogroll. I think it'll improve the value of my web site Smile

  • Business

    10/15/2016 2:54:43 AM | Reply

    hello!,I like your writing very a lot! proportion we be in contact more about your post on AOL? I require an expert in this area to solve my problem. Maybe that's you! Taking a look forward to see you.

  • Games Online

    10/15/2016 2:54:44 AM | Reply

    It is perfect time to make some plans for the future and it is time to be happy. I have read this post and if I could I desire to suggest you some interesting things or tips. Perhaps you can write next articles referring to this article. I wish to read even more things about it!

  • Recreation

    10/19/2016 2:11:08 AM | Reply

    you're actually a good webmaster. The website loading pace is amazing. It sort of feels that you're doing any distinctive trick. Furthermore, The contents are masterpiece. you have done a wonderful task on this subject!

  • Health &amp; Society

    10/19/2016 2:11:11 AM | Reply

    I like what you guys are up too. Such smart work and reporting! Keep up the excellent works guys I¡¦ve incorporated you guys to my blogroll. I think it will improve the value of my site Smile

  • Law &amp; Legal

    10/19/2016 2:11:14 AM | Reply

    Thank you, I have recently been searching for info approximately this subject for a long time and yours is the best I've came upon till now. However, what concerning the conclusion? Are you positive concerning the source?

  • Games Online

    10/19/2016 2:11:30 AM | Reply

    Great write-up, I am regular visitor of one¡¦s site, maintain up the excellent operate, and It's going to be a regular visitor for a lengthy time.

  • Recreation

    10/19/2016 2:11:30 AM | Reply

    you are actually a just right webmaster. The site loading speed is amazing. It sort of feels that you're doing any distinctive trick. Moreover, The contents are masterpiece. you've done a excellent task on this subject!

  • Games

    10/19/2016 2:11:30 AM | Reply

    I not to mention my friends appeared to be reviewing the great tips and hints on your web blog and so immediately came up with a horrible suspicion I never expressed respect to the website owner for them. All of the boys had been so joyful to learn all of them and have in actuality been loving those things. Appreciation for genuinely simply considerate and then for deciding upon certain exceptional themes millions of individuals are really desirous to be informed on. My very own sincere regret for not saying thanks to you sooner.

  • Business

    10/19/2016 2:11:30 AM | Reply

    Fantastic website. A lot of helpful info here. I¡¦m sending it to some buddies ans additionally sharing in delicious. And of course, thank you in your sweat!

  • Computer &amp; Internet

    10/19/2016 2:11:34 AM | Reply

    Definitely believe that which you said. Your favorite justification appeared to be on the internet the easiest thing to be aware of. I say to you, I definitely get annoyed while people consider worries that they plainly don't know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people could take a signal. Will likely be back to get more. Thanks

  • Arts

    10/19/2016 2:11:39 AM | Reply

    Wow, awesome blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is great, let alone the content!

  • csgo boosting

    11/13/2016 11:47:12 PM | Reply

    I together with my friends have been looking at the excellent helpful tips located on your web blog then instantly I had a horrible suspicion I had not expressed respect to the site owner for them. All of the ladies are actually for this reason warmed to read through them and have in effect definitely been taking pleasure in those things. I appreciate you for getting really considerate and then for utilizing certain good information millions of individuals are really needing to know about. Our own honest apologies for not expressing appreciation to you earlier.

  • Susanna Hohmann

    11/21/2016 10:06:06 AM | Reply

    Between me and my husband we've owned more MP3 players over the years than I can count, including Sansas, iRivers, iPods (classic & touch), the Ibiza Rhapsody, etc. But, the last few years I've settled down to one line of players. Why? Because I was happy to discover how well-designed and fun to use the underappreciated (and widely mocked) Zunes are.

  • official statement

    4/11/2017 8:20:17 AM | Reply

    I just want to tell you that I am newbie to weblog and absolutely enjoyed this web page. Probably I’m likely to bookmark your blog post . You really have impressive article content. Thanks a lot for sharing your webpage.

  • Erik Hannon

    4/17/2017 8:31:17 PM | Reply

    Hey There. I found your blog using msn. This is a very well written article. I will be sure to bookmark it and return to read more of your useful info. Thanks for the post. I will certainly comeback.<a href="http://www.vu8.top/";>entertainment news</a>.

  • Tuan Keet

    4/18/2017 7:18:55 PM | Reply

    Hey, you used to write fantastic, but the last several posts have been kinda boring?I miss your great writings. Past several posts are just a little out of track! come on<a href="http://www.54m.top/";>sports news</a>!

  • httP://www.8sky.top

    4/21/2017 7:53:21 PM | Reply

    Hey, you used to write great, but the last few posts have been kinda boring?I miss your great writings. Past several posts are just a bit out of track! come on<a href="http://www.8sky.top/";>world news</a>!

  • httP://www.8sky.top

    4/23/2017 11:46:16 PM | Reply

    I've been absent for some time, but now I remember why I used to love this site. Thanks, I will try and check back more often. How frequently you update your <a href="http://www.8sky.top/";>SKY news</a>.

  • httP://www.8sky.top

    4/24/2017 12:49:29 AM | Reply

    I like what you guys are up also. Such smart work and reporting! Keep up the excellent works guys I've incorporated you guys to my blogroll. I think it'll improve the value of my <a href="http://www.8sky.top/";>breaking news</a>.

  • httP://www.8sky.top

    5/18/2017 10:27:07 PM | Reply

    I've been absent for a while, but now I remember why I used to love this website. Thank you, I'll try and check back more often. How frequently you update your <a href="http://www.8sky.top/";>news online</a>.

  • httP://www.8sky.top

    5/18/2017 11:11:22 PM | Reply

    I have been absent for a while, but now I remember why I used to love this website. Thank you, I'll try and check back more often. How frequently you update your <a href="http://www.8sky.top/";>entertainment news</a>.

  • www.8sky.top

    5/19/2017 6:51:42 PM | Reply

    Hello, you used to write great, but the last several posts have been kinda boring?I miss your super writings. Past few posts are just a little bit out of track! come on<a href="http://www.8sky.top/";>health news</a>!

  • www.8sky.top

    6/9/2017 12:02:42 AM | Reply

    Hello, you used to write magnificent, but the last few posts have been kinda boring?I miss your tremendous writings. Past few posts are just a little out of track! come on<a href="http://www.8sky.top/";>sports news</a>!

  • read review

    6/19/2017 4:42:03 PM | Reply

    I just want to mention I am newbie to blogging and actually savored this web blog. Likely I’m want to bookmark your blog . You actually have awesome writings. Thanks a bunch for sharing with us your blog.

  • &amp;#x062F;&amp;#x0648;&amp;#x0631;&amp;#x0628;&amp;#x06CC;&amp;#x0646; &amp;#x0645;&amp;#x062F;&amp;#x0627;&amp;#x0631;&amp;#x0628;&amp;#x0633;&amp;#x062A;&amp;#x0647;

    6/26/2017 4:19:10 AM | Reply

    Awesome write-up. I am a normal visitor of your web site and appreciate you taking the time to maintain the excellent site. I’ll be a frequent visitor for a really long time.

Loading