How to put Meta details in Content page?

Last post 07-29-2009 5:36 PM by run4it. 8 replies.

Sort Posts:

  • How to put Meta details in Content page?

    02-15-2009, 8:47 AM
    • Member
      2 point Member
    • LisaMac
    • Member since 01-22-2009, 4:56 AM
    • Posts 19
    Hi,Can anyone help me put something in my Content page that is different from my Master page please?  In the Head of my Masterpage, after the title, there are several Meta lines. There’s a Meta line for the description, a  Meta line for the keywords, one for the Robots etc…  After that my Body section starts.  What I need to do (at least, I think that’s what I need to do?) is have different Meta description and Meta keywords in each of my Content pages.  How do I do that please, it keeps reading the Masterpage - instead how do I give each Content page its own separate Meta description? I don’t mind if someone responds to say I’m asking the wrong question - because often I don’t know how to explain what I need. And my bottom line is that I need Google to read a different Meta description and Keywords for each Content  page - so I assume I’m asking the correct question for that? Regards, LisaMac

     

  • Re: How to put Meta details in Content page?

    02-15-2009, 9:01 AM
    • Star
      10,558 point Star
    • Danny117
    • Member since 12-16-2008, 2:30 PM
    • Royal Oak Michigan USA
    • Posts 1,837

    here's the description.  The keywords are done the same way.

    Dim meta As New HtmlMeta()
                            meta.Name = "Description"
                            meta.Content = "LisaMac is cool"
                            Page.Header.Controls.Add(meta)

     

    Good Luck



  • Re: How to put Meta details in Content page?

    02-15-2009, 9:02 AM
    • All-Star
      59,185 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,483
    • TrustedFriends-MVPs

    you can add it dynamically on each content page

    HtmlMeta meta;

    meta = new HtmlMeta();

    meta.Name = "keywords";meta.Content = "sas, sas, sas, sas";

    Page.Header.Controls.Add(meta);

     

     

    HtmlMeta meta;

    meta = new HtmlMeta();

    meta.Name = "description";

    meta.Content = "description goes here";

    Page.Header.Controls.Add(meta);

  • Re: How to put Meta details in Content page?

    02-15-2009, 10:55 AM
    • Member
      2 point Member
    • LisaMac
    • Member since 01-22-2009, 4:56 AM
    • Posts 19

    Thank you to both replies. I should add what you both described BEFORE my ContentPlaceholder, yes?  Before I add your suggestion my content page will look like this.....

    <%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %><script runat="server"></script><asp:Content ID="Content1" ContentPlaceHolderID="leftContent" Runat="Server"></asp:Content>

     

    And now when I add what you suggested it will look like this, yes? 

     

    <%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %>HtmlMeta meta; meta = new HtmlMeta();meta.Name = "description"; meta.Content = "description goes here";Page.Header.Controls.Add(meta); <script runat="server"></script><asp:Content ID="Content1" ContentPlaceHolderID="leftContent" Runat="Server"></asp:Content>

    I'm just checking that I'm putting it in the correct place, yes?

     

    Regards LisaMac

  • Re: How to put Meta details in Content page?

    02-15-2009, 11:05 AM
    • All-Star
      59,185 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,483
    • TrustedFriends-MVPs

    Place the code I have givenyou in codebehind of ur content page in page load

  • Re: How to put Meta details in Content page?

    02-15-2009, 11:13 AM
    • Member
      2 point Member
    • LisaMac
    • Member since 01-22-2009, 4:56 AM
    • Posts 19

     Hi, that was a quick response, thank you.  The following is all I have on the Code Behind (source) of my Content page. I don't know what Page Load is?  I just need the exact location/line of where to add the new Meta info, that you told me about above. Do I insert it before the <asp:Content......?

    <%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %> <script runat="server"></script> <asp:Content ID="Content1" ContentPlaceHolderID="leftContent" Runat="Server"></asp:Content>

     

  • Re: How to put Meta details in Content page?

    02-15-2009, 11:26 AM
    Answer
    • All-Star
      59,185 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,483
    • TrustedFriends-MVPs

    This way 

    <script runat="server" type = "text/VB" >

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Dim meta As HtmlMeta

    meta = New HtmlMeta()

    meta.Name = "keywords"

    meta.Content = "sas, sas, sas, sas"

    Page.Header.Controls.Add(meta)

    End Sub

    </script>

  • Re: How to put Meta details in Content page?

    02-15-2009, 12:07 PM
    • Member
      2 point Member
    • LisaMac
    • Member since 01-22-2009, 4:56 AM
    • Posts 19

     

    ah, it goes inside the script thing. thank you. 

     Kind Regards to both for answering me

    LisaMac

  • Re: How to put Meta details in Content page?

    07-29-2009, 5:36 PM
    • Member
      40 point Member
    • run4it
    • Member since 12-27-2002, 8:29 AM
    • Olympia WA, USA
    • Posts 257

    I am using this method to create the metatags for the pages in my website.  Can anyone tell me what to add to the method so that each <meta > tag is on a new line in the rendered source code? 

Page 1 of 1 (9 items)