| 7:43 pm on Jan 10, 2003 (gmt 0)|
I don't understand.
| 7:51 pm on Jan 10, 2003 (gmt 0)|
The script that makes me different title for each page and got the title text from somwhere inside <body></body>
| 7:54 pm on Jan 10, 2003 (gmt 0)|
What language are you using? ASP, PHP, JSP?
| 7:55 pm on Jan 10, 2003 (gmt 0)|
PHP is the language available for me.
| 8:01 pm on Jan 10, 2003 (gmt 0)|
paff, I'm no PHP expert but my guess is you'll have to restructure the code to put the head in the dynamic section, i.e., instead of generating the head and the top of the page, then doing all the dynamic stuff, you'll have to get the dynamic info first and then write the whole page.
| 9:15 pm on Jan 10, 2003 (gmt 0)|
I didnt understand.Anyway would it be too big loss if i put same title for every page?
| 10:03 pm on Jan 10, 2003 (gmt 0)|
I create the title dynamically by looking at the variables in the URL. It's not a perfect solution, but I think having an appropriate title is important.
For example: index.html?section=widgets&sub=blue
If there is no "sub" variable, the title is "My Site - Widgets". If the sub variable is there, I check it against a list of possible sub-titles: ["Blue Widgets", "Red Widgets"] and just append it: "My Site - Widgets - Blue Widgets"
It's not pretty, but I'm much happier having page titles, especially since I have heard it can improve search engine rankings.
| 10:18 pm on Jan 10, 2003 (gmt 0)|
I think that creating the title on the fly from the content on the page would be a little too intensive. You could do it site wide when changes are made and store them in a db. You could write them by hand and store them in a db as well.
Finder's idea is a very nice one, hadn't thought of it. I, personally, would write them all by hand and then store them in a db and then call the proper one for the proper page using an include.
| 2:41 am on Jan 11, 2003 (gmt 0)|
I'm having a hard time imagining what would prevent you from hard coding the titles to begin with - unless you are using a db. If using a db, then follow jatar_k's suggestion and just include the titles in the db (their own field). If not using a db then you've already built the pages yes? So why not add titles at that time? Of have I missed something extremely obvious? :)
| 2:55 am on Jan 11, 2003 (gmt 0)|
I generally have a keyword-rich headline stored in the database, when displaying the content of my page, I request all the content, and for SEO purposes, store the headline text as a php variable and use that variable in the title and <h1> tags on the page.
Seems to work well in the search engines most of the time :)
|brotherhood of LAN|
| 3:28 am on Jan 11, 2003 (gmt 0)|
I've been re-writing pages to grab info out a db, all the page info is made available by a variable in the filename, i.e. a number.
The number is the primary id for the page, providing title,meta description, page title etc.
IMHO its "lazy" in the fact the titles can be hard coded in certain pages, but for a situation like a "web directory" the dynamic creation of titles if pretty cool, i.e. for > breadcrumb > navigation
| 9:23 am on Jan 11, 2003 (gmt 0)|
ok,my problem is like that:
I have allready made all my pages.
They are built up like that:
title tag is inside 1.htm.
So if i change title,it changes in every page.
Im really stuck.
| 10:11 am on Jan 11, 2003 (gmt 0)|
In 1.htm, where the title tag is, write: <title><?=$title?></title>
And just define that variable before including it:
| 1:08 pm on Jan 11, 2003 (gmt 0)|
I guess i have to make it your way allthough it takes forever.
| 1:41 pm on Jan 11, 2003 (gmt 0)|
>variable in the title and <h1> tags on the page
I used this a lot, also append it to the end of the meta description.
It is good if you notice a trend in the log files you can update the pages content very quickly i.e xmas/christmas :)
Do you think having H1 & title that match exactly is asking for trouble?
| 1:47 pm on Jan 11, 2003 (gmt 0)|
I know one thing that could solve my problem.Lets say i have title inside body tag.Is there some script that moves title automatically inside head tag.It would really help.Hope you understand what i was trying to say.
| 4:04 pm on Jan 11, 2003 (gmt 0)|
Within the body tag you may only use the title attribute. The title element is not allowed.
If the title is hard coded within the body element (though I know of no sensible reason why it should be there) then you could postprocess your output by using output buffering and registering a call back function when starting output buffering [php.net]. A better solution would be to change all your documents. That way the server would not have to do the same work over and over again for each request.
If the title is not hard coded within the body element but the code to get it is currently within your include file that produces the body tag then you should move the code so that it gets executed right at the start of your script as rogerd suggested. c3oc3oīs suggestion is one way to get the title to appear in your first include after the code changes.
If you are willing to share what you do not understand about this approach then I am most certain that somebody here will gladly help you. Just saying I didnt understand sounds more like "I donīt like the advise and canīt be bothered to think about its merits."
| 12:00 am on Jan 12, 2003 (gmt 0)|
>>Do you think having H1 & title that match exactly is asking for trouble?
I've never had any trouble before (touching wood now), however, I do concatenate the company name to the title, which makes it a little harder to identify automatically.
<title>$headline - $companyname</title>
For some of my sites the abstract of the page is also in the database, which makes creating the description tag very easy.
<title>$headline - $companyname</title>
<meta name="description" content="$abstract">
Leaves with me with training the data entry guys to create keyword rich headlines and abstracts....but thats not as easy as it sounds ;)
<added>paff3, is there anything in your database you can use as a title? otherwise it seems you are left with hardcoding them, or trying to harvest that information from your pages with a view to insert them into the database </added>
| 9:30 am on Jan 13, 2003 (gmt 0)|
Meta keywords dont have much weight but just for good measure :)
<meta keywords=".............." & split(headline,",") & ">"