diff --git a/Sources/Display.php b/Sources/Display.php
index 8397b56..1ba77e4 100644
--- a/Sources/Display.php
+++ b/Sources/Display.php
@@ -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(
diff --git a/Themes/default/index.template.php b/Themes/default/index.template.php
index 534f87a..04f791d 100644
--- a/Themes/default/index.template.php
+++ b/Themes/default/index.template.php
@@ -94,6 +94,9 @@ function template_main_above()
';
+ if (!empty($context['canonical_url']))
+ echo '
+ ';
// 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'])) {