improving google link titles in results returned search ...

Please report bugs here!

Moderator: Thorsten

Post Reply
Lidio
Posts: 25
Joined: Mon Dec 10, 2007 9:26 pm

improving google link titles in results returned search ...

Post by Lidio »

I view this as being more of an omission rather than a bug (not quite a feature proposal, if there is better section please move it).

When google index your phpMyFaq site it will use the generated pages with the html title values as part of the results to any query at google.com

The html title is composed with your configuration Title of the FAQ setting and either the article's title or " - powered by phpMyFAQ 2.0.x". The code segment

Code: Select all

'title'             => $faqconfig->get('main.titleFAQ').$title,
does it.

For "solution id" and "tags" it defaults to " - powered by phpMyFAQ 2.0.x" which is not as useful.

By changing in index.php from

Code: Select all

//
// found a solution ID?
//
if (isset($_REQUEST['solution_id']) && is_numeric($_REQUEST['solution_id']) === true) {
    $solution_id = (int)$_REQUEST['solution_id'];
    $title       = ' -  powered by phpMyFAQ '.$faqconfig->get('main.currentVersion');
    $keywords    = '';
    $a = $faq->getIdFromSolutionId($solution_id);
    if (is_array($a)) {
        $id = $a['id'];
        $lang = $a['lang'];
    }
}

to

Code: Select all

//
// found a solution ID?
//
if (isset($_REQUEST['solution_id']) && is_numeric($_REQUEST['solution_id']) === true) {
    $solution_id = (int)$_REQUEST['solution_id'];
    $title       = ' -  powered by phpMyFAQ '.$faqconfig->get('main.currentVersion');
    $keywords    = '';
    $a = $faq->getIdFromSolutionId($solution_id);
    if (is_array($a)) {
        $id = $a['id'];
        $lang = $a['lang'];
        $title    = ' - ' . $faq->getRecordTitle($id);
        $keywords = ' ' . $faq->getRecordKeywords($id);
    }
}
and adding after that code block the following

Code: Select all

//
// Handle the Tagging ID 
//
if (isset($_REQUEST['tagging_id']) && is_numeric($_REQUEST['tagging_id'])) {
    $tag_id = (int)$_REQUEST['tagging_id'];
    $title = ' - ' . $oTag->getTagNameById($tag_id);
    $keywords = '';
}
Both solution id and tags will have more meaning info when search results are returned by google. Enjoy.

Lidio.
Thorsten
Posts: 15769
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

I added this code to phpMyFAQ 2.5.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply