Jump to content

Meta tags showing multiple times on pages


ineedhelp73

Recommended Posts

Definitely a NooB to php programming. This has to do with a client's site where the meta tags are called for specific pages but he has it setup where meta tags are being shown 5 times within the source code. When asked about the issue this is what he sent:

 

"I know about the meta tag problem but I'm not sure how to fix it... I use php with some 'include' commands. Simply, one page pulls another page into itself.... my index.html looks something like this:

 

<head>

some stuff including meta info

</head>

 

<body>

?php(include'pageheader.html');

?php(incldue'pagebody.html');

?php(include'someothercrap.html');

</body>

 

those include files all have their own meta info.... so when php pulls the files in, it includes meta info in the body of the index.html page. I have been looking around to see how people handle this but haven't spent enough time on it.... I need to do a rewrite anyway so I'll probably stop using them then if I can't figure out a work around."

 

If anyone can throw some advice our way it would be super appreciated. I have been looking for a cool place to pick on my php. Much appreciated if able. If I posted this in the wrong section I apologize.

 

Tony

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Remove all the meta info from the other pages that are included and put the meta info into a separate "include" page.  Then simply put that include into the header info on each page.  Simple workaround and will not necessitate a full scale recoding.

 

Current:

<head>
some stuff including meta info
</head>

<body>
?php(include'pageheader.html');
?php(incldue'pagebody.html');
?php(include'someothercrap.html');
</body>

 

Meta.php page:

<?php
$meta = '<title>MyPage.com</title>
  <meta http-equiv="Content-Type" content="text/html charset=UTF-8">';
?>

 

New html page:

<?php require('includes/meta.php'); ?>

<head>
<?php echo $meta; ?>
</head>

<body>
?php(include'pageheader.html');
?php(incldue'pagebody.html');
?php(include'someothercrap.html');
</body>

 

Do that for each page that needs fixing.  Again just quick and dirty, not necessarily the right way to fix it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.