|
| |
|
|
Anita K
Posts: 4 Joined: 12/11/2007 Status: offline
|
Master Page and Meta - 12/11/2007 23:49:33
if i have many pages with the same master page connected to them, where would i place my keyword phrases with a meta tag. Example, i have a information page with the navigation master attached to it, if i wanted to put keyword phrases for seo purposes for this information page should i do it on the information page which has NO head section or on the master page attached to it which does have a head section with meta tags already there? but if i use the master page then it would be the same for all other pages it is connected to. is it okay to insert a <head> tag into the information page? thank you so much
< Message edited by Anita K -- 12/12/2007 8:47:45 >
|
|
|
|
rdouglass
Posts: 9229 From: Biddeford, ME USA Status: offline
|
RE: Master Page and Meta - 12/12/2007 9:23:59
Hi and Welcome to OutFront. Since you used the term 'master page', I assume you're using .NET. Have you tried using the Me.Header class on your code-behind page? Me.Header.Title = "My Page Title" or for keywords, something like this: Dim metaDescription As New HtmlMeta() metaDescription.Name = "keywords" metaDescription.Content = "keyword1, keyword2" Me.Header.Controls.Add(metaDescription) Hope it helps. EDIT. Put this on the information page and not on the master unless of course, you want all pages to use it.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Anita K
Posts: 4 Joined: 12/11/2007 Status: offline
|
RE: Master Page and Meta - 12/12/2007 13:50:56
thank you so much for the advice. i can't wait to try it, and yes we are using .net. my only question is when putting this on the information page, where exactly or should i ask with any special tags?
|
|
|
|
rdouglass
Posts: 9229 From: Biddeford, ME USA Status: offline
|
RE: Master Page and Meta - 12/12/2007 15:18:44
Personally, I always use code-behind pages so my page (xxxx.aspx.vb) would look something like this: Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Partial Class MyPageClass
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim metaDescription As New HtmlMeta()
metaDescription.Name = "keywords"
metaDescription.Content = "keyword1, keyword2"
Me.Header.Controls.Add(metaDescription)
End Sub
End Class
Something like that. Hope it helps.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Anita K
Posts: 4 Joined: 12/11/2007 Status: offline
|
RE: Master Page and Meta - 12/13/2007 13:58:49
Is this a separate page all together? please excuse my ignorance in this area. If it is, then is it linked somehow to the page I want to use it on?
|
|
|
|
rdouglass
Posts: 9229 From: Biddeford, ME USA Status: offline
|
RE: Master Page and Meta - 12/13/2007 16:14:45
quote:
Is this a separate page all together? Yes it is. Its called a 'code behind' page. For instance, if I have a page called Test.aspx, my code behind page (for VB.NET stuff) would be Test.aspx.vb and the pages could contain code like this: Test.aspx <%@ Page Language="VB" MasterPageFile="~/NewBlank.master" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="TestClass" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ctphTitle" Runat="Server">
</asp:Content>
Test.aspx.vb
Partial Class TestClass
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim metaDescription As New HtmlMeta()
metaDescription.Name = "keywords"
metaDescription.Content = "keyword1, keyword2"
Me.Header.Controls.Add(metaDescription)
End Sub
End Class
At least thats the best way I've found to deal with custom meta tags when using a Master page. Just remember both pages need to be in the same directory. Notice the code in the declaration on the aspx page: ... CodeFile="Test.aspx.vb" Inherits="TestClass" ... That's where you tell the page where the code behind is and what class to use. See the .vb file where we define the class "TestClass"? It can probably be done on the same page with some <script runat=server> tag but I'm not familiar with it. Thant help any?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|