"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Sunday, December 5, 2010

adding metatags from server side or dynamic Metatags

It's really hard to predict the metatags for a website which work like forums.Because user is entering data and storing in database and it's fully dynamic, For this cases the metatags are created from serverside.

Code:

        Page.Header.Controls.Add(new LiteralControl("\n"));
        HtmlMeta metakeyword = new HtmlMeta();
        metakeyword.Name = "Keywords";
        metakeyword.Content = "Add keywords here";

        HtmlMeta Metadisption = new HtmlMeta();
        Metadisption.Name = "description";
        Metadisption.Content = "add meta description here";

        Page.Header.Controls.Add(metakeyword);
        Page.Header.Controls.Add(new LiteralControl("\n"));
        Page.Header.Controls.Add(Metadisption);

Demo:


Have a nice day... 'N happy Coding :)

No comments: