Skip to:
Content
Pages
Categories
Search
Top
Bottom

Confused about HTML Meta tags & SEO


  • Michael3185
    Member

    @michael3185

    Now I’ve got a couple of forums working the way users need, I’m looking into getting them noticed on the web. I’ve read masses of information on this, including use of HTML page Meta tags and data, plus words in the Meta being in the pages, etc. I must say, I’m somewhat confused by it all.

    I don’t have the time to try and become a search engine submission expert, and my charity clients don’t have the money to pay for services like that either. I understand the basic concept of including some HTML Meta tags for search engines to process. Should I just add these manually to index.php, or does it get re-written on the fly by bbPress? (I haven’t tested that yet).

    How difficult would it be to create a plugin, say, that lets you enter HTML Meta tags and data in Admin, and then just inserts it into the forum pages so search engines find them? I guess that’s what some of the mentions about v1.0’s meta stuff are about? (I’m using 0.9.0.5) Any help much appreciated.

    [edit]

    Actually, I realise that a simpler way would be to just write a text file with the HTML Meta information in it, and somehow include it in the header section of various files (or is it only really required in index.php?) I’ve seen an ‘include once’ directive, but guess that just makes a file’s functions available rather than inserting it directly into another? Apologies if the answer is so basic I shouldn’t need to ask, but after six weeks of hard work my head’s fried.

Viewing 13 replies - 1 through 13 (of 13 total)
  • To add meta tag using plugin…

    add_action('bb_head', 'meta_bb_header');

    function meta_bb_header() {
    echo 'Your meta tag here';
    }

    Maybe you can use ping service like Ping-o-Matic that were design for blog, to notify other service that you have update your forum. Never try it yet with bbpress so kinda don’t know how it gonna be :)

    Another alternative maybe submit sitemap at Google Webmaster.


    Michael3185
    Member

    @michael3185

    Neat. Thanks for that – I’ll try those ideas asap.

    Below is the code I wrote for “SEO”-related tweaks. It tries to fill the description meta with something relevant, and adds keywords based on a combination of tags and site-wide words (added via the admin screen). It’s still rough round the edges. For example, it will produce duplicate descriptions on multi-page topics, and descriptions may not be terribly different from the title tag.

    <?php
    /*
    Plugin Name: SEO Tweaks
    Description: Adds description and keywords meta to the header.
    Author: Tim Howgego
    Author URI: http://timhowgego.com/
    Version: 0.1.rc
    */

    add_action('bb_admin_menu_generator', 'seo_config_menu');
    add_action('bb_admin-header.php', 'seo_config_process');

    add_action('bb_head', 'seo_meta_description');
    add_action('bb_head', 'seo_meta_keywords');

    function seo_meta_description() {

    switch ( bb_get_location() ) {

    case 'topic-page':
    $description = get_topic_title()." - ".bb_get_option( 'description' );
    break;

    case 'forum-page':
    $description = get_forum_description();
    break;

    case 'tag-page':
    if ( is_bb_tag() ) {
    $description = __('Topics tagged')." ".bb_get_tag_name();
    } else {
    $description = __('List of tagged topics.');
    }
    break;

    case 'profile-page':
    $description = __('Profile for')." ".get_user_display_name()." - ".__('includes contact information and posting history.');
    break;

    case 'view-page':
    $description = get_view_name()." - ".bb_get_option( 'description' );
    break;

    default:
    $description = bb_get_option( 'description' );
    break;
    }

    echo '<meta name="description" content="'.attribute_escape( $description ).'" />'."n";

    }

    function seo_meta_keywords() {

    // Includes enhancements by _ck_

    global $tags;
    $keywords = array();

    if ( !empty( $tags ) ) {
    foreach ( $tags as $t ) {
    $keywords[] = $t->raw_tag;
    }
    }

    $default_keywords = bb_get_option( 'seo_keywords' );

    if ( count( $default_keywords ) >0 ) {
    $keywords[] = $default_keywords;
    }

    if ( count( $keywords ) >0 ) {
    echo '<meta name="keywords" content="'.attribute_escape( implode( ", ", $keywords ) ).'" />'."n";
    }
    }

    function seo_config_menu() {
    bb_admin_add_submenu(__('SEO'), 'manage_plugins', 'seo_config_page');
    }

    function seo_config_page() {

    ?>
    <h2><?php _e('SEO Tweaks Configuration'); ?></h2>

    <form class="options" method="post" action="">

    <fieldset>
    <p><strong><label for="seo_keywords"><?php _e('Default keywords') ?></label></strong> (<?php _e('these words will be attached to every page, so only use words that describe the forum's overall content'); ?>):</p>
    <textarea name="seo_keywords" id="seo_keywords" cols="100" rows="4"><?php bb_form_option( 'seo_keywords' ); ?></textarea>
    <p><?php _e('Separate keywords with a comma. No formatting.'); ?></p>
    </fieldset>

    <fieldset>
    <?php bb_nonce_field( 'seo_config' ); ?>
    <input type="hidden" name="action" id="action" value="update_seo_config" />
    <input type="submit" name="submit" id="submit" value="<?php _e('Save Changes &raquo;') ?>" />
    </fieldset>

    </form>
    <?php

    }

    function seo_config_process() {

    if ($_POST['action'] == 'update_seo_config') {

    bb_check_admin_referer( 'seo_config' );

    if ($_POST['seo_keywords']) {
    $value = htmlentities( trim( $_POST['seo_keywords'] ) , ENT_NOQUOTES );
    if ($value) {
    bb_update_option( 'seo_keywords', $value );
    } else {
    bb_delete_option( 'seo_keywords' );
    }
    } else {
    bb_delete_option( 'seo_keywords' );
    }

    $goback = add_query_arg( 'seo_updated', 'true', wp_get_referer() );
    bb_safe_redirect( $goback );
    exit;
    }

    if ($_GET['seo_updated']) {
    bb_admin_notice( __('Changes saved.') );
    }

    }

    ?>


    Michael3185
    Member

    @michael3185

    Cheers tinskii – I’ll try that right away. Atsutane’s idea worked great, but to have it automatically updated is really neat.

    I’ve read in a lot of places that the Meta HTML tags are ignored by Google and others, but it’s got to be useful if some search engines still use them. Many thanks. I’ll even hack around with the code and see if I can learn anything. Though I think there’s something wrong with bbPress. Whenever I modify anything, it stops working (hehe).


    Michael3185
    Member

    @michael3185

    Timskii, I set this up as a plugin, and added some keywords in Admin, but it only adds those words in the head section, nothing else. I’m on 0.9.0.5


    chrishajer
    Participant

    @chrishajer

    Where were you expecting the keywords? Keyword meta tags belong in the <head> section of the page. Are you talking about the admin interface or the source of the rendered page? I’m curious because I was thinking of using this as well.


    Michael3185
    Member

    @michael3185

    It puts this in the head section of http://mbforum.letsdoo.org;

    <META name=”keywords” content=”mum, mother, baby, babies, maternity, pregnancy, childbirth, child birth, child, children, family, NHS”>

    but those are all keywords I added via Admin – no other words are added from tags or site-wide words, as timskii suggests.


    chrishajer
    Participant

    @chrishajer

    I see, sorry. Reading the original more carefully now I see what you mean. It puts *only* the keywords from the admin screen into the meta tag, nothing from the specific topic or post. What URL are you talking about (since the case handles different types of pages differently)?


    Michael3185
    Member

    @michael3185

    Just realised I’d only checked the front page, but topic/post pages are the same – no extra words added.

    Extra keywords are based on tags. If there are no tags on the page, there are not extra keywords.

    All this does is take meta information that is already available within the data structure of the forum, and put it into an HTML meta field.

    One could gather additional meta information by distilling the content of pages. But I suspect Google/etc would be better at distilling the content of the page automatically than any plugin. So I don’t anticipate making this much more complicated, although there are no doubt a few easy enhancements that can be made.


    Michael3185
    Member

    @michael3185

    Hi timskii. The pages with tags aren’t having the tags put into the meta, for some reason. No matter what page I go to, the only meta info is what I typed in via the Admin section. Mind you, even that’s very useful!

    There is another SEO plugin for bbPress:

    http://bbpress.org/forums/topic/adding-meta-tags-or-seo-option#post-27178

    It is also rough but it does a good job altogether.


    Michael3185
    Member

    @michael3185

    Thanks dragunoff, I’ll give that a try too.

Viewing 13 replies - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.