Add canonical urls anywhere possible
This commit is contained in:
@@ -350,6 +350,11 @@ function Display()
|
||||
'current_page' => $_REQUEST['start'] / $modSettings['defaultMaxMessages'] + 1,
|
||||
'num_pages' => floor($topicinfo['numReplies'] / $modSettings['defaultMaxMessages']) + 1
|
||||
);
|
||||
if (isset ($_REQUEST['topicname'])) {
|
||||
$context['canonical_url'] = "/forum/{$_REQUEST['topicname']}?start={$_REQUEST['start']}";
|
||||
} else {
|
||||
$context['canonical_url'] = $scripturl . '?topic=' . $topic . '.' . $_REQUEST['start'];
|
||||
}
|
||||
|
||||
// Figure out all the link to the next/prev/first/last/etc. for wireless mainly.
|
||||
$context['links'] = array(
|
||||
|
||||
@@ -94,6 +94,9 @@ function template_main_above()
|
||||
<link rel="stylesheet" type="text/css" href="http://rock.ru/forum/markitup/sets/bbcode/style.css" />
|
||||
<link rel="alternate" type="application/rss+xml" title="Новые сообщения в теме" href="http://rock.ru/forum/yarss.php?topic=' . $context['current_topic'] . '" />';
|
||||
|
||||
if (!empty($context['canonical_url']))
|
||||
echo '
|
||||
<link rel="canonical" href="' . $context['canonical_url'] . '"/>';
|
||||
|
||||
// If we're in a board, or a topic for that matter, the index will be the board's index.
|
||||
if (!empty($context['current_board'])) {
|
||||
|
||||
Reference in New Issue
Block a user