I currently have the title tags in the footer of my site. This is because the title is dynamic, and if I place it in the head then it's blank, as the title content doesn't get loaded until the body.
My question is, does it matter, SEO wise, that the title tags are in the footer as opposed to the header?
I currently have the title tags in the footer of my site.
That is not valid. Title tags must be in the <head>
section:
Every HTML document must have a
TITLE
element in theHEAD
section.
Also, it will probably give real-world problems. I have never seen title
tags used in the page's footer, and I expect they are going to be ignored by search engines there.
You should change the underlying architecture of your PHP script so you can know the title when the page starts.
Reference:
"if I place it in the head then it's blank, as the title content doesn't get loaded until the body."
- that means that your site design is wrong
You should use templates and proper page layout.
In fact, your page code should output nothing, but only gater required data and then either throw an error or call a template
A concise example:
page called links.php
:
<?
//include our settings, connect to database etc.
include dirname($_SERVER['DOCUMENT_ROOT']).'/cfg/settings.php';
//getting required data
$DATA=dbgetarr("SELECT * FROM links");
$pagetitle = "Links to friend sites";
//etc
//and then call a template:
$tpl = "links.php";
include "template.php";
?>
Now template.php
which is your main site template, consists of your header and footer:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My site. <?=$pagetitle?></title>
</head>
<body>
<div id="page">
<? include $tpl ?>
</div>
</body>
</html>
and links.php
is the actual page template:
<h2><?=$pagetitle?></h2>
<ul>
<? foreach($DATA as $row): ?>
<li><a href="<?=$row['link']?>" target="_blank"><?=$row['name']?></a></li>
<? endforeach ?>
<ul>
easy, clean and maintainable.
I use a similiar approach to the Col. but this one will take your filenames i.e (my_contact_form.php) and change it to "My Contact Form" as your page title. Not exactly what you needed but i just wanted to give you another option.
I have an file called config.php which holds my functions etc..
<?php
// dynamic page titles
$page = basename($_SERVER['SCRIPT_FILENAME']);
$page = str_replace('_',' ',$page);
$page = str_replace('.php','',$page);
$page = ucwords($page);
?>
now i just call the page include on any page where i want the titles to be replaced
<?php require("config.php") ?>
and use the title as follows
<title>Your Site Name » <?php echo $page; ?></title>