开发者

Three HTML Tags in One Page

开发者 https://www.devze.com 2023-02-17 11:29 出处:网络
So I have a regular PHP page which includes the header, body, and the footer. So <?php include(\'header.html\');

So I have a regular PHP page which includes the header, body, and the footer.

So

<?php include('header.html');
?>
So header.html has <html>... content </html>

Same with Footer.html

and the index.php has one <html>Tag too.</html>

So is this bad for SEO or something els开发者_开发技巧e?

How to fix it?

Thanks.


Search engines will see exactly what the browser sees. So they know as much about your includes as the user: Nothing.

However, according your question your HTML code is horribly invalid as it seems to look like that:

<html>header stuff</html>
<html>page stuff</html>
<html>footer stuff</html>

Your templates should be like that:

header:

<html><head>...</head><body>some common content stuff for all pages

content:

some stuff for your body

footer:

some common content stuff for all pages</body></html>


It's bad for everything, not just SEO, because its plain wrong HTML.

You fix it by removing the invalid elements (<html> tags) from the includes.

Check the resulting page with a validator to find more such errors: http://validator.w3.org


Well, it is invalid HTML. So I wouldn't be surprised if you are penalised in search results because of this.

How to fix? Just get rid of the <html> tags that aren't needed...? You only need one opening and one closing <html> tag on a HTML document.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号