问题
My header is called as you can imagine, on each pages.
it means that on each pages i've the same title (bad for SEO)
Is there a workaround to set pages title outside the header.php ?
Thanks
回答1:
Make a variable $page_title
. Set it before including the header and in the header have something like:
echo("<title>$page_title</title>");
回答2:
Set a variable for the title before including the header, then output the variable within the header.
回答3:
include ('includes/header.php');
titleAndMeta('yourTitle');
This goes in your page and this goes in your header.php
function titleAndMeta($title)
echo '<title>$title</title>';
来源:https://stackoverflow.com/questions/2825776/header-how-to-modify-title-of-the-page-on-the-fly