PDA

View Full Version : Dynamic Title Tag


Boof
30-06-2003, 13:57/01:57PM
Hello,

I really enjoy looking through these forums. They have been very helpful.

I don't know if this is the correct forum to post this question in... so I'm sorry if its not.

I have a dynamic website using .asp. Is there anyway to create dynamic Title Tags for each query?

Thanks!

polarmate
30-06-2003, 14:01/02:01PM
<title><%Response.Write "Your cool title here"%></title>


Let's assume that you want to show an optimized title for your products. You can use Response.Write to display your product name from your recordset. You can even have a column in your table that contains an optimized title for each product and display that viz:

<title><%Response.Write rs("OptTitle")%></title>


HTH!

Boof
30-06-2003, 14:09/02:09PM
Thanks! I think that should help.

Do you recommend doing this for dynamic websites?

polarmate
30-06-2003, 14:21/02:21PM
I use it with no problems. My pages have been spidered by Google. I have only 2 parameters on most of them but ona few I have 3 and those pages have been spidered too. And some of these pages rank high for their targeted keywords.

Boof
30-06-2003, 15:35/03:35PM
I tried to do what you said, and it is not turning our correctly. Are there speical things I need to know to do this?

:confused:

polarmate
30-06-2003, 15:48/03:48PM
Boof, check your PM

dsearchguy
30-06-2003, 16:43/04:43PM
Are you using an include file across your site for navigation?

vinyl-junkie
30-06-2003, 20:25/08:25PM
Boof, if you still need help, send me a PM and describe whatever problems you're having. I have a lot of dynamic content pages on my website where I'm building the title using ASP. I'm even doing some meta tags with ASP. I'll be glad to help. :)

Webmaster T
30-06-2003, 20:40/08:40PM
Set Constants in an included file for each directory/category/topic and build titles, metas and <H1> from the DB and the Constants and you'll be good to go in no time.

dvduval
30-06-2003, 22:42/10:42PM
At the top of the dynamic page I use this:

<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim strTitle
dim strDesc
strTitle="My Title"
strDesc="Here is my description."
%>

Then in the include file, I use this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<%
response.write ("<html>" + "<head>" + "<title>" + strTitle +"</title>" & vbNewLine)
response.write ("<meta name=" + """description""" + " content=""" + strDesc + """" + "/>")
response.write ("<link rel= " + """stylesheet""" + "type= " + """text/css""" + "href= " + """../style.css""" + "/>" & vbNewLine)
response.write ("<meta http-equiv= " + """Content-Type""" + "content= " + """text/html; charset=iso-8859-1""" + "/>" + "</head>")
%>

<body>


This works for me, but I'm open to constructive criticism.

polarmate
30-06-2003, 22:55/10:55PM
I wonder if Boof has had a look at all the folks who want to help her out! It just serves as a wonderful testimony to these forums!!

Boof does not have any programming experience and I am holding her hand as she adds to and edits the code on her web pages.

:cheers: to you all!!

vinyl-junkie
30-06-2003, 23:28/11:28PM
Originally posted by polarmate
I wonder if Boof has had a look at all the folks who want to help her out! It just serves as a wonderful testimony to these forums!! Since you have everything under control, Polarmate, how about if I just lead the cheering section? :)

Seriously, I love writing dynamic pages myself. Good to see someone else getting interested in it as well. Go, Boof! :cheers:

Boof
01-07-2003, 11:33/11:33AM
Sorry I have not responded yet. I haven't had a chance to check the forum until this morning.

Thanks for all of the help! These forums are very helpful, I really appreciate all the help from everyone!


Polarmate - I sent you a PM, did you get it?

polarmate
01-07-2003, 11:45/11:45AM
Hey Boof, I wrote back to you last night - check your PM - the tracking on it says 'unread.'

Boof
01-07-2003, 12:30/12:30PM
I just checked it, Thanks!

g1smd
01-07-2003, 20:37/08:37PM
dvduval check your post. I think there are an incorrect number of ""quotes"" on some of the words. That is I see stuff like """word" in places.

dvduval
01-07-2003, 21:07/09:07PM
g1smd, """ is what is known as an escaped quote. Take this for example:
response.write ("<meta name=" + """description""" + " content=""" + strDesc + """" + "/>")

In order to put the word "description" in quotes, you have to escape the quotes like this: """description"""

This take A LOT of getting used to. It drove me crazy at first.

As a side not, in PHP you escape quotes with a / right before the quote character.

g1smd
01-07-2003, 21:22/09:22PM
I was looking at " content=""" as an error, as it was not symmetrical.

Uhhh, now realised that is OK; but of course I would not have thought that it was an error, if the attribute value had actually been filled in. D'oh!

Hmm, it's 2 hours to sunrise here. Need sleep.