|
Meta Tags and Master Pages
03-13-2006, 01:16 PM
|
Meta Tags and Master Pages
|
Posts: 28
Location: Amherst, Nova Scotia, Canada
|
Hey Webmasters,
I've been searching articles and forums trying to figure out a good way to have meta tags that the spiders and SE's can read. I go to some sites to check the position analysis of my sites and when I try analyzing my sites with master pages some will see them some will not. I've also tried many ways to programmatically add these as I have been told to do from many articles but each one I try then check the source of my page no Meta Tags. I am new to MasterPages but love them ever so much. Can anyone help me with an effective way to programmatically add my meta tags to each content page?
Thanks,
Dave
__________________
David Downey
CEO, President
Davez Designz - Please login or register to view this content. Registration is FREE
Last edited by DavezDesignz; 03-13-2006 at 02:38 PM..
|
|
|
|
03-13-2006, 03:36 PM
|
Re: Meta Tags and Master Pages
|
Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
|
I take it MasterPages is the latest "kewl" name for M$ FrontPage includes then.
how to add meta info (not that it's worth bothering about) to pages will depend on how your content is being put into the pages.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
|
|
|
|
03-13-2006, 03:44 PM
|
Re: Meta Tags and Master Pages
|
Posts: 28
Location: Amherst, Nova Scotia, Canada
|
A Master page is like a template page where you just put your basic layout and then you add your content sections and when you derive the rest of your pages from this MasterPage you only have the content section to work with. It is new in ASP.NET 2.0
Microsofts Desription:
.NET Framework Class Library
MasterPage Class
Note: This class is new in the .NET Framework version 2.0.
Acts as a template and merging container for pages that are composed only of Content controls and their respective child controls. Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
I've been using the new Visual Web Developer 2005 for quite a few months now and have grown to love it but there are things that are done differently and now am just stuck with a way to properly add the meta tags to the content pages to update the ones on the master page with the keywords and desriptions for the respective content pages.
I don't know if Frontpage has anything to do with this because I haven't used it in years actually I never used it I prefer dreamweaver or just plain write all the code myself in textpad or notepad.
__________________
David Downey
CEO, President
Davez Designz - Please login or register to view this content. Registration is FREE
Last edited by DavezDesignz; 03-13-2006 at 03:46 PM..
|
|
|
|
03-13-2006, 04:26 PM
|
Re: Meta Tags and Master Pages
|
Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
|
basically server side includes then
I would think that meta tags would be added in the same way as any server side include by inserting a variable.
and BTW this thread is already too much time spent considering the meta tags WRT SEO.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
|
|
|
|
03-13-2006, 05:32 PM
|
Re: Meta Tags and Master Pages
|
Posts: 28
Location: Amherst, Nova Scotia, Canada
|
Well everyone is entitled to their own opinions!
but I tried using variables with no luck so please don't reply unless you actually have a solution bc you don't even know what masterpages are so you could not possibly help. thanks anyway!
__________________
David Downey
CEO, President
Davez Designz - Please login or register to view this content. Registration is FREE
|
|
|
|
03-14-2006, 04:14 AM
|
Re: Meta Tags and Master Pages
|
Posts: 1,186
Location: Manchester, UK
|
Chris is right when he says those meta tags are not worth bothering about for se placement.
But if you want to set them for another reason, there is an article at dotnetjunkies.com
|
|
|
|
03-14-2006, 06:35 AM
|
Re: Meta Tags and Master Pages
|
Posts: 1,626
Location: Guildford, UK
|
Quote:
|
basically server side includes then
|
Far from it, actually. Master pages are a godsend. Although, they do introduce their fair share of issues...
What you can do is make the <head> tag a server control in the master page:
<head id="MyHead" runat="server">
then you can add controls to it.
(untested off the top of my head code...)
MyHead.Controls.Add(new LitrelControl("<meta name=\"description\" content=\"Your Description\" />"));
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
|
|
|
|
03-14-2006, 10:17 AM
|
Re: Meta Tags and Master Pages
|
Posts: 28
Location: Amherst, Nova Scotia, Canada
|
Quote:
|
Originally Posted by Minaki
Far from it, actually. Master pages are a godsend. Although, they do introduce their fair share of issues...
|
Thats exactly what I was thinking when chrishirst wrote that comment. SSI huh? no way!. and they are a godsend and can you show me anything that doesn't have its' issues. As for the code sadly it didn't work so I'm just gonna keep searching.. it's not that it really matters but I would just like to know how it's done effectively. I'm just that type of person that's just got to know. Thanks for trying though Minaki!
__________________
David Downey
CEO, President
Davez Designz - Please login or register to view this content. Registration is FREE
|
|
|
|
03-14-2006, 10:42 AM
|
Re: Meta Tags and Master Pages
|
Posts: 1,626
Location: Guildford, UK
|
That code should work... although I think I spelt Litral wrong. I use it to add styles the header. Or at least something along those lines. I'd check the exact thing I use but unfortunately my main comps died and all my code is on that hard drive...
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
|
|
|
|
03-14-2006, 12:08 PM
|
Re: Meta Tags and Master Pages
|
Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
|
Obviously you don't use ASP includes then because you can exactly the same thing without needing the M$ Nanny hand-holding stuff and much quicker.
I saw somebody posting on another forum a few days ago how .NET2.0 was so much better than 1.1 because he had built a mailto form and code using all these server controls and it had only taken him about 4 hours to get it all working.
4 hours !!! with ASP I can have a form built and producing emails in about 20 mins. All that is happening is that M$ is dumbing down any programming skills needed and reducing it to a few button clicks. All using M$ technology of course.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
|
|
|
|
03-14-2006, 06:19 PM
|
Re: Meta Tags and Master Pages
|
Posts: 28
Location: Amherst, Nova Scotia, Canada
|
but just cause it takes one guy 4 hours doesn't mean it takes everyone 4 hours.. It takes me less than 5 minutes to create an email form. and I used to use includes but I have no need for them now really, sometimes I use them but thats only for tracking scripts and counters. just try it for yourself and you might be impressed. All depends on what you like to do and how you like to do it... everyone is entitled to his/her opinions and preferences. but anyway I'm looking for a solution for this not a different way to do this. I want to know for my own knowledge not because I want to implement it at the moment but when and if I do decide to it would be nice to know anyway I'll figure out how its done one way or another.
__________________
David Downey
CEO, President
Davez Designz - Please login or register to view this content. Registration is FREE
|
|
|
|
03-15-2006, 06:00 AM
|
Re: Meta Tags and Master Pages
|
Posts: 1,626
Location: Guildford, UK
|
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
|
|
|
|
04-27-2006, 08:13 AM
|
Re: Meta Tags and Master Pages
|
Posts: 1
|
Hello David and everyone else!
Before i realized that Meta tags and Master pages don't go that well together, i tried placing them as part of a "ContentPlaceHolder" and it seemed to work fine displaying the required Meta tag in the source of the page, when i ran it.
That would mean that it works, doesn't it?
This just seems like too simple a solution... but it worked, or atleast i think it did. Can someone tell me why this solution won't do?
Cheers,
Munira
The code is below
In the content Page
<asp:ContentID="Content2"ContentPlaceHolderID="Metadata"Runat="Server">
<title> Default Page Title</title>
<metaname="keywords"content="Having different Metadata with different pages."/>
</asp:Content>
In the Master Page.
<head>
<asp:ContentPlaceHolderID="Metadata"runat="server">
</asp:ContentPlaceHolder>
</head>
|
|
|
|
04-27-2006, 01:10 PM
|
Re: Meta Tags and Master Pages
|
Posts: 28
Location: Amherst, Nova Scotia, Canada
|
because most search engines look for them in the head of the document but they really aren't as important as what they once were. I was just trying to do it programmatically to learn how to.
__________________
David Downey
CEO, President
Davez Designz - Please login or register to view this content. Registration is FREE
|
|
|
|
07-07-2006, 10:25 AM
|
Re: Meta Tags and Master Pages
|
Posts: 2
Location: Atlanta, GA
|
chrishirst is going to have trouble making it in the field with the idea that time will stand still, the glory days of asp will last forever, and van halen will make their come back from the 80's. Fact is .NET 2.0 is the standard, Master pages are the new standard (which are much more powerful then an include file), and legacy ASP is an outdated technology.
In response to DavezDesignz's question:
For a short time you could use
base.Master.Page.Header.Metadata.Add("Keywords", "blah, blah");
but this method was lost somewhere between beta 1 and 2.
One method you can use is:
HtmlMeta meta = newHtmlMeta();
meta.Name = "Keywords";
meta.Content = "balh, blah";
You would then add the control to your header. This needs to be done in your Page_Load.
-Good Luck
|
|
|
|
07-07-2006, 01:58 PM
|
Re: Meta Tags and Master Pages
|
Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
|
Well thanks for your concern regarding my future, but as I seem to be doing perfectly well without bothering with the latest and greatest offering from M$.
I have no need or desire to "make it" in whatever field you think I'm in, you would probably be wrong anyway as it is in no way related to the subjects on here, so learning a ASP.NET language is pretty low on my list of priorities.
If I ever find a real reason to use it, beyond the "it's the future" arguments I will do. For now I'll stick with writing 5 or 6 lines of code where .net would need double or triple that to achieve the same results.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
|
|
|
|
07-10-2006, 06:33 AM
|
Re: Meta Tags and Master Pages
|
Posts: 1,626
Location: Guildford, UK
|
Actually I find it the other way round... for example, when uploading files, you need a whole COM object or script in ASP, whereas in .NET you just use MyUploadComponent.PostedFile.SaveAs(WhateverFileNa me) and you're done.
It's the same for working with images, all the code you need is built in - you don't have to mess around with 3rd party COM objects. You can even load the contents of an uploaded image directly into an image object and manipulate it with the Imageing classes.
If you think ASP.NET needs 'double or tripple' the ammount of code ASP does, then I don't know what language you're looking at - but it's not VB.NET or C#!!
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Please login or register to view this content. Registration is FREE | Please login or register to view this content. Registration is FREE
|
|
|
|
07-12-2006, 10:52 AM
|
Re: Meta Tags and Master Pages
|
Posts: 2
Location: Atlanta, GA
|
Minaki is correct in saying that many processes have been streamlined in .NET. Chris I didn't mean to get you worked up but I do notice that your profile says you're a web developer. I'm not an advocate for Microsoft I'm just saying that you have to keep up with the newest technologies to stay relevant in the field (web development).
I noticed that I left off how to add the control to the header on my last post. For anyone who still needs it:
HtmlMeta meta = new HtmlMeta();
meta.Name = "Keywords";
meta.Content = "keyword1, keyword2, etc.";
Header.Controls.Add(meta);
Open the page in a browser and view it's source, you will notice that the <meta> tag is inserted into the header along with your meta data. You would repeat this on each of your content pages in which you wanted seperate meta tags otherwise you would just include it in the Master page.
|
|
|
|
07-17-2006, 12:46 AM
|
Re: Meta Tags and Master Pages
|
Posts: 28
Location: Amherst, Nova Scotia, Canada
|
I agree with you totally Oracle and Minaki. I love ASP.NET I really don't care who doesn't but I wanna learn as much as I can about it. I will try your solution and see how it works out.
__________________
David Downey
CEO, President
Davez Designz - Please login or register to view this content. Registration is FREE
Last edited by DavezDesignz; 07-17-2006 at 12:49 AM..
|
|
|
|
07-28-2006, 04:57 AM
|
Re: Meta Tags and Master Pages
|
Posts: 215
Name: Syed Saadat Ali
Location: Lahore, Pakistan
|
Adding a literal contorl, creating HtmlMeta first and then adding it to controls
both works.
e.g.
Page.Header.Controls.Add(newLiteralControl(@"<meta name='keywords' content='keyword1, keyword2' />"));
OR
HtmlMeta meta = newHtmlMeta();
meta.Name = "keywords";
meta.Content = "keyword1, keyword2";
Page.Header.Controls.Add(meta);
NOTE: Dont use serverside header tag for adding content to it. It will overwrite all the code written in html.
__________________
- -- --- ---- ----- ------ ------- ---------------
If you have knowledge, let others light their candles in it.
|
|
|
|
|
« Reply to Meta Tags and Master Pages
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|