Google renders the title as it should but it renders the description from the text on the page so all pages get the same description. I have been trying to find the error for several days but have not succeeded
This is the link that google reads from a file
Blockquote https://xxxx.com/index.php?id=något
This is a very short version of index.php
Blockquote<?php
ini_set(‘display_errors’, ‘0’);
session_start();
$recept = $_GET[‘idrec’];
$livsmedel = $_GET[‘id’];
// Conect to database and get the values i need
?>
<?php if (!empty($livsmedel)&& empty($recept)) { echo "Title nr 1 ";}
if (empty($livsmedel)&& !empty($recept)) { echo “Title nr 2 “;}
if (!empty($livsmedel)) { echo implode(’ ‘, array_slice(explode(’ ‘, $livsmedel), 0, 7));}
else { echo implode(’ ‘, array_slice(explode(’ ‘, $recept), 0, 7));}
if (empty($livsmedel) && empty($recept)) { echo “Title nr 3”;} ?>
<meta name=“description” content= "<?php if (!empty($livsmedel))
{ echo “description nr 1”; echo implode(’ ‘, array_slice(explode(’ ', $livsmedel), 0, 7)); echo " the rest of description nr 1” ; }
if (!empty($recept))
{ echo “description nr 2”; echo implode(’ ‘, array_slice(explode(’ ', $recept), 0, 7)); echo " the rest of description nr 2.” ; }?><?php if (empty($livsmedel) && empty($recept))
{ echo “description nr 3.”;} ?> ">