1 (edited by cigs 2009-11-03 08:57)

Topic: Too long title on topic posts page

I noticed, it is too long title on topic posts page ... I think it is not too good for SEO

How to make title on topic name only???

I also dont like "(Page1)" and whatever in title tag ...

<title> tag could be nicer

for example this topic:

<title>Too long title on topic posts page (Page 1) - PunBB 1.3 discussion - PunBB Forums</title>

  smile

Express your tobacco tastes at Cigarettes Forum online.

Re: Too long title on topic posts page

The page title is generated based on the page breadcrumbs. Setting breadcrumbs for a viewtopic page is done at 231-235 lines of "viewtopic.php". The function "generate_crumbs" (502 line of "<FORUM_ROOT>/include/functions.php") generates the resulting string. Will this information be enough for you?

3

Re: Too long title on topic posts page

viewtopic.php
lines: 230-235

// Setup breadcrumbs
$forum_page['crumbs'] = array(
    array($forum_config['o_board_title'], forum_link($forum_url['index'])),
    array($cur_topic['forum_name'], forum_link($forum_url['forum'], array($cur_topic['forum_id'], sef_friendly($cur_topic['forum_name'])))),
    array($cur_topic['subject'], forum_link($forum_url['topic'], array($id, sef_friendly($cur_topic['subject']))))
);

include/functions.php
lines: 501-533

// Generate breadcrumb navigation
function generate_crumbs($reverse)
{
    global $lang_common, $forum_url, $forum_config, $forum_page;

    $return = ($hook = get_hook('fn_generate_crumbs_start')) ? eval($hook) : null;
    if ($return != null)
        return $return;

    if (empty($forum_page['crumbs']))
        $forum_page['crumbs'][0] = $forum_config['o_board_title'];

    $crumbs = '';
    $num_crumbs = count($forum_page['crumbs']);

    if ($reverse)
    {
        for ($i = ($num_crumbs - 1); $i >= 0; --$i)
            $crumbs .= (is_array($forum_page['crumbs'][$i]) ? forum_htmlencode($forum_page['crumbs'][$i][0]) : forum_htmlencode($forum_page['crumbs'][$i])).((isset($forum_page['page']) && $i == ($num_crumbs - 1)) ? ' ('.$lang_common['Page'].' '.forum_number_format($forum_page['page']).')' : '').($i > 0 ? $lang_common['Title separator'] : '');
    }
    else
        for ($i = 0; $i < $num_crumbs; ++$i)
        {
            if ($i < ($num_crumbs - 1))
                $crumbs .= '<span class="crumb'.(($i == 0) ? ' crumbfirst' : '').'">'.(($i >= 1) ? '<span>'.$lang_common['Crumb separator'].'</span>' : '').(is_array($forum_page['crumbs'][$i]) ? '<a href="'.$forum_page['crumbs'][$i][1].'">'.forum_htmlencode($forum_page['crumbs'][$i][0]).'</a>' : forum_htmlencode($forum_page['crumbs'][$i])).'</span> ';
            else
                $crumbs .= '<span class="crumb crumblast'.(($i == 0) ? ' crumbfirst' : '').'">'.(($i >= 1) ? '<span>'.$lang_common['Crumb separator'].'</span>' : '').(is_array($forum_page['crumbs'][$i]) ? '<a href="'.$forum_page['crumbs'][$i][1].'">'.forum_htmlencode($forum_page['crumbs'][$i][0]).'</a>' : forum_htmlencode($forum_page['crumbs'][$i])).'</span> ';
        }

    ($hook = get_hook('fn_generate_crumbs_end')) ? eval($hook) : null;

    return $crumbs;
}

where do i fix to remove

<title>.....- PunBB 1.3 discussion - PunBB Forums</title>

for example on this forum topic page ... ???

Express your tobacco tastes at Cigarettes Forum online.

4

Re: Too long title on topic posts page

Try replacing the code you got from viewtopic.php with this:

// Setup breadcrumbs
$forum_page['crumbs'] = array(
    array($forum_config['o_board_title'], forum_link($forum_url['index'])),
    array($cur_topic['forum_name'], forum_link($forum_url['forum'], array($cur_topic['forum_id'], sef_friendly($cur_topic['forum_name']))))
);

If that works, tell me. I have to leave for work, like, right now so I can't test/remove the code from functions.php

5

Re: Too long title on topic posts page

no -- it didnt work -- looks like it stays the same

Express your tobacco tastes at Cigarettes Forum online.

Re: Too long title on topic posts page

Could you fix this after all? I see that this thread title for instance is just as you wanted... how did you it go with your own forum?

If you do what you've always done, you'll get what you've always gotten.