Is it considered bad to put the <title>
tag outside the <head>
tag? I’m using PHP and I only know the page name after loading the header.php file where <head>
is located. Would placing the <title>
tag later in the page influence SEO or cause any other browser related problems or would you advice against it?
2
Answers
Yes the
title
tag should only be used in thehead
.So I’m guessing your
header.php
has a line like this:And on your pages you have an
include('pathtofile/header.php');
Just define
$title
before the include line.Example:
Or if it isn’t structured like that you may want to change it up a bit.
The
title
is part of the metadata of the document, so yes, it would be semantically incorrect to put it outside thehead
: