Fixing duplicate meta descriptions in Kunena forum posts for SEO benefit

Wednesday, 23 May 2012 17:45 Written by  Ed
Rate this item
(0 votes)

It is common knowledge that having duplicate meta descriptions for different page in your website can harm your SEO efforts. If you are using the Kunena forum component for Joomla! you may have noticed this can create duplicate meta descriptions that will appear in Google Webmaster tools.

One way of getting round this problem is to append page numbers to each new forum post thereby making them unique.

In Kunena 1.7.2 the meta descriptions for each forum post are created in the file

../components/com_kunena/funcs/view.php

Look at the code below from the view.php file :

               // Create Meta Description form the content of the first message

               // better for search results display but NOT for search ranking!

               $metaDesc = KunenaParser::stripBBCode($this->first_message->message);

               $metaDesc = strip_tags($metaDesc); // Now remove all tags

               $metaDesc = preg_replace('/\s+/', ' ', $metaDesc); // remove newlines

$metaDesc = preg_replace('/^[^\w0-9]+/', '', $metaDesc); // remove characters at the beginning that are not letters or numbers

               $metaDesc = trim($metaDesc); // Remove trailing spaces and beginning

We could manipulate the code here to append a page number to this meta description to make it unique. Code below:

$page = 0;

if ($limit) {

$page = ($limitstart / $limit) + 1;

}

if ($page>1) {

    $metaDesc=' Page ' . $page. $metaDesc;

} else {

}

This will should append page numbers to the beginning of each new forum post.

Last modified on Wednesday, 05 December 2012 09:57
Ed

Ed