Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I add a rel=”me” attribute to an xprofile field?

  • @gregfielding

    Participant

    Playing more with the google author code, it is definitely good for SEO to have a google profile xprofile field, with a rel=”me” attribute.

    Any ideas on how to assign this?

    Thanks!

Viewing 18 replies - 1 through 18 (of 18 total)
  • @enderandrew

    Member

    I’d be very interested in this as well.

    @gregfielding

    Participant

    Here’s an article by Yoast where we explains how to add rel=”me” to standard WP profiles. Any thoughts on how we could incorporate this into BP Profiles?

    I’m assuming it could be as simple as a short snip of code that adds the attribute to the profile field, but maybe it’s more complicated…

    @gregfielding

    Participant

    @gregfielding

    Participant

    The politest of bumps…

    @gregfielding

    Participant

    @boonebgorges
    Any chance this could be added to Custom Profile Filters?

    @djpaul

    Keymaster

    Yeah, this isn’t super easy to do with regards to UI. Adding this type of microformat markup to core is something I would personally like to see in BP 1.4.

    @gregfielding

    Participant

    @djpaul
    For now, I’m not worried about the user interface. Hardcoding it in somewhere would be ample.

    This will be big for SEO.

    @gregfielding

    Participant

    `//relme
    function relme ($output) {
    global $bp;
    if ( bp_field_has_data( ‘782’ ) ) {
    return str_replace(‘<a ','<a rel="me" ',$output);
    }
    }
    add_filter(‘xprofile_screen_display_profile’, ‘relme’);`

    I’m doing my best to hack my way through this. Here’s what I have – it doesn’t work, but it also doesn’t break the site.

    Field #782 is my Google Profile ID field.

    @hnla

    Participant

    Try adding it with jQuery

    @djpaul

    Keymaster

    hnla: No, that’s not a good idea because Google will ignore it with jQuery.

    Greg: I agree hardcoding it is a good idea, but I always have core in mind when I read this sort of discussion :) xprofile_screen_display_profile is an action, not a filter. I assume you’re trying to change the value of an xprofiel field. ‘bp_get_the_profile_field_value’ is probably the filter you want.

    `
    function gf_relme($value, $type, $id) {
    if (782 == $id) {
    return str_replace(‘<a ','<a rel="me" ',$value);
    }
    }
    add_filter(‘bp_get_the_profile_field_value’, ‘gf_relme’, 10, 3);
    `

    @gregfielding

    Participant

    @djpaul
    That did the trick of adding rel=”me” – but now none of the other profile fields show.

    See: http://housingstorm.com/gregfielding/profile/

    @djpaul

    Keymaster

    oh, doh. put an

    `else { return $value; }`

    after the if closing bracket.

    While we’re talking about rel=me, what’s your opinion on if I add rel=”me” on the field(s) in BP-Default for BP 1.3? Bear in mind all the different member sub profile pages etc.

    @gregfielding

    Participant

    Thanks Paul – that works great.

    You mean on all fields? I don’t think it would hurt anything…

    @djpaul

    Keymaster

    Sorry, on these ones: http://i55.tinypic.com/1qk977.png

    @gregfielding

    Participant

    @djpaul
    Those should be rel=”author” because they link to the “author” (profile) page. Then, from the profile page, there should be a rel=me link to google.

    Here’s the article that explains the relationship: http://www.google.com/support/webmasters/bin/answer.py?answer=1229920&hl=en

    @hnla

    Participant

    hnla: No, that’s not a good idea because Google will ignore it with jQuery.

    It shouldn’t, Google understands scripting, why would it ignore jquery?, It’s not the best idea though agreed.

    Can we avoid though adding this stuff to core, core Must at some point start to separate properly mid tier and frontend presentational layers, atts are the business of the frontend coder BP should be dispassionate about such stuff I don’t want them but will have them forced on me :)

    @djpaul

    Keymaster

    That’s what I get for posting near midnight when I’m tired :)

    I’ll probably add the rel=”author” in for those areas (I’ve added it for blog posts already), but nothing else for now.

    @gregfielding

    Participant

    @djpaul
    Any ideas how to att rel=”author” to the userlink? I added it to the avatar in entry.php, which was easy, but the userlink is more complex.

Viewing 18 replies - 1 through 18 (of 18 total)
  • The topic ‘How can I add a rel=”me” attribute to an xprofile field?’ is closed to new replies.
Skip to toolbar