Keywords

If I don’t use a CMS, but the website is with PHP/MySql (not OOP), please tell me how can I have on every page different keywords on the meta tag ?

By typing them with your keyboard inside the ‘content’ attribute of a <meta> tag.

Every page has the header in

include("header.php");

where is the meta tags too. If i will do that I have to have a different header.php for every page, but it’s not a small site.

It’s pretty easy…

You can just use variables in header.php like this:



<title><?=$title?></title>
<meta name='description' content='<?=$description?>'>
<meta name='keywords' content='<?=$keywords?>'>


and set them for each page like this:



$title='Yo Mamma Jokes';	
$description='Yo Mamma so fat... Yo Mamma so Old...';
$keywords='yo, mamma, jokes';

include 'header.php';


Homie_187’s solution relies on you having short_tags enabled, so watch out.

How are you going to generate the tags?

Firstly I’d say don’t bother with the meta keywords. The meta description can be useful to improve your chances of getting good description text in the SERPs. The mechanics of customizing it for each page is demonstrated by Homie above.

Thank you. I will used.

I saw that Cups. I don’t use short tags. Thank you.

It’s better to use <?php echo $var; ?> than <?= $var ?> anyway, whether you have short tags enabled or not.