0

Maybe its a stupied question but i didnt fild any answer for it, If i have file with the html tag head tag&meta.. and I include him in all my web page, its effect the seo of the site?

I have file named "start_html.php" that have this code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="description" content="bla bla.">
    <meta name="keywords" content="bla bla">
    <meta name="author" content="bla">
    <title>bla bla</title>
    <!-- CSS: -->
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
    <!-- JavaScript -->
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

I start every page with this line: <?php include('start_html.php'); ?>

When i check for code error on w3c validator its says that i dont have those tags so the page is not coded good.

  • With PHP, the page is rendered server-side, so it's not going to make a difference whether you've got the header in an include. Though if the W3 Validator tells you that they're not there, are you sure your header file is being included properly? – andrewsi Apr 19 '13 at 13:38
  • 1
    you are **not** including it if it isn't showing. – itachi Apr 19 '13 at 13:39
  • Click the "view source" checkbox on W3validator to see what text they are looking at – Uberfuzzy Apr 19 '13 at 14:08

3 Answers3

0

If the code from that file is not being displayed in your web page then obviously your PHP code is incorrect and that file is not being included. You need to make sure you have error reporting on and displaying all errors as this will catch this for you.

See this StackOverflow question for how to enable error reporting.

Community
  • 1
  • 1
John Conde
  • 217,595
  • 99
  • 455
  • 496
0

You should have these meta and title tags on all your pages, so including them from PHP is certainly not a bad idea. However, if the W3 validator tells you these tags aren't there, you should check your output. Perhaps start by 'show source code' in your browser, and see if the tags appear there.

Borniet
  • 3,544
  • 4
  • 24
  • 33
0

If you try to send your source file for validation, where you have: <?php include('start_html.php'); ?>

Of course you will get the expected result - no tags, because the source file must be parsed and handled by PHP.

You can give a working link for validation, or copy output in your browser after execution, save the file and send it.

sybear
  • 7,837
  • 1
  • 22
  • 38