Skip to:
Content
Pages
Categories
Search
Top
Bottom

Brilliant solution to bbPress SEO! Page number to title!

  • @hpguru

    Member

    Just replace title in header.php in your theme:

    <title><?php bb_title() ?><?php if (bb_is_front()) { echo " - Your forum slogan";} ?><?php if ($page>1) { echo ' « Page '. $page; } ?></title>

    Unmangled: http://pastie.org/1028304

    Have a nice day and thanks to Zaerl to bb_is_front.

    I need function "if is home" to bbPress

    Example: Your topic title « Your forum name « Page 15

    If you are in topic’s page 15!

Viewing 10 replies - 1 through 10 (of 10 total)
  • @_ck_

    Participant

    Hmm, is page number in the title important to SEO?

    It is an attempt to avoid duplicate content penalty?

    Because Google already understands bbPress forum layout, they are very clever like that.

    @kevinjohngallagher

    Member

    It’s a combo of SEO and HCI.

    Having a different title for each page makes life easier for humans, as well as not being bad for SEO.

    In the strictest sense, Google (et al) state that every page should have it’s own and unique title, and if relative should be linked with a canonical link.

    (though, there is no doubt that they’re clever enough to work it out).

    @_ck_

    Participant

    You know what, this idea grew on me, I like it and off to apply it.

    It could be done a little fancier via the filters on bb_title and bb_get_title ie. the page could be injected between the forum name and the topic name, but this will do for now.

    @kevinjohngallagher

    Member

    Dammit,

    _ck_ I updated my plugin 2 weeks ago.

    I’ll post it here in 20 when I’m home. I thought I’d put a download link on my website, but i must have bumped it with all the talking over the last week.

    @kevinjohngallagher

    Member

    @_ck_

    Participant

    Hey good work.

    Let me make a strong suggestion in your code technique.

    All those variable names being tossed around as globals is somewhat dangerous – someone is going to accidentally “step” on one someday.

    Instead how about an array or object instead?

    ie.

    $topic_add_quotes=blah;
    $topic_add_sticky=blah;
    $topic_add_sticky_label=blah;
    etc.

    and

    global $topic_add_quotes;
    global $topic_add_sticky;
    global $topic_add_sticky_label;
    etc.

    instead becomes

    $kjg_seo->topic_add_quotes=blah;
    $kjg_seo->topic_add_sticky=blah;
    $kjg_seo->topic_add_sticky_label=blah;
    etc.

    and then no matter how many items you just pass one pointer in your functions

    global $kjg_seo;

    The added benefit is you can later loop through all the elements if you make an admin menu.

    Also, when switching based on page type, constantly calling all the different functions, ie is_forum, is_front, is_topic etc is “expensive” because of how bb_get_location works

    Instead just $location=bb_get_location();

    and then look at what it sends you in the string which is ultra fast for each of the comparisons.

    @kevinjohngallagher

    Member

    _ck_,

    Really apprecaite the hints.

    I’m definately not a PHP coder by trade, so these sorts of tips are invaluable.

    Cheers,

    Kev

    @kevinjohngallagher

    Member

    More of an FYI, I found some time last night and uploaded a new version:

    http://www.kevinjohngallagher.com/downloads/bbpress/plugins/kevinjohngallagher_seo.zip

    @pastorbobsforum

    Member

    Hello.

    Is this plugin (Kevin’s) officially released?

    Because the php file seems…unfinished.

    Thank you.

    Bob

    @kevinjohngallagher

    Member

    Hi Bob,

    Finished is not quite the word i’d use to describe it, but it works as intended.

    I generally like to scope out all of the thing I want a plugin to do, and then I can add to it incrementally, which is why there are 4 functions with no code in them (but they’re never called, it’s more placeholders).

    The code isn’t released under a GPL yet, not that I’d try submitting them here anyway given past horrors with the system, but please feel free to use it on your forums Bob, and shout me if you’ve any issues.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Skip to toolbar