Article Title in Page Title

Asked by Birch

Can I use each article's title in the <title></title> tag in the html file which views the news pages? How can I integrate the variable? This is very important as far as SEO is concerned.

Question information

Language:
English Edit question
Status:
Solved
For:
phpns Edit question
Assignee:
No assignee Edit question
Solved by:
Birch
Solved:
Last query:
Last reply:
Revision history for this message
dorkass (dprkass) said :
#1

It depends on if you're viewing the single article at a time, or several at a time. If you're viewing the single article, just set a new include in your <title> tag with a template that shows only the news title...then just include shownews.php again, with that template, and of course the category you're showing in your current article. This works fine, I do it on my own sites.

example:

<title>
dorkass.net -
<?php
$phpns['items_per_page'] = 1;
$phpns['template'] = 19;
$phpns['category'] = 34;
include('shownews.php');
?>
</title>

<body>
<div id="widebody">
<?php
$phpns['disable_pagination'] = FALSE;
$phpns['items_per_page'] = 1;
$phpns['template'] = 13;
$phpns['category'] = 34;
include('shownews.php');
?>
</div>
</body>

Revision history for this message
Birch (pr-birch) said :
#2

Well, I use your solution, and, it works. But, before the title there is a little square.

http://www.komixmag.gr/view_news.php?a=16

Why does that happen?