Open atimmer opened 7 years ago
See #7056
See also #1971
Above user suggests some other plugins have:
a way to limit SEO on certain pages only. This may be the way out of the problem that you're experiencing.
This may help to avoid the issue with BuddyPress Member Pages using the Yoast 404 title template tags
Hi! Here is my code snippets for BuddyPress and Yoast SEO integration.
You can check links in "Source" section to get more information about author.
/**
* First solution for BuddyPress SEO title
* (+ need to add title in meta-data in html code)
* Source: https://goo.gl/nC2WMW
*/
function wpseo_fix_title_buddypress( $title ) {
if ( function_exists( 'buddypress') && ( !empty( buddypress()->displayed_user->id ) || !empty( buddypress()->current_component ) ) ) {
$bp_title_parts = bp_modify_document_title_parts();
$title = $bp_title_parts['title'] . ' ' . $title;
}
return $title;
}
add_filter( 'wpseo_title', 'wpseo_fix_title_buddypress' );
Source: https://bit.ly/2KSSL8Z
/**
* Generate meta description
* Source: https://bit.ly/2KSSL8Z
*/
function bpdev_bp_items_metadesc( $desc ) {
if ( bp_is_blog_page() || bp_is_directory() ) {
return $desc;
}
if ( bp_is_user() ) {
$desc = sprintf( '%s website description', bp_get_displayed_user_fullname() );
if ( function_exists( 'buddyblog_is_single_post' ) && buddyblog_is_single_post() ) {
$post_id = 0;
if ( buddyblog_use_slug_in_permalink() ) {
$slug = bp_action_variable( 0 );
$post_id = buddyblog_get_post_id_from_slug( $slug );
} else {
$post_id = intval( bp_action_variable( 0 ) );
}
if ( $post_id ) {
$tmp_post_desc = WPSEO_Meta::get_value( 'metadesc', $post_id );
if ( $tmp_post_desc ) {
$desc = $tmp_post_desc;
}
}
}
} elseif ( bp_is_active( 'groups' ) && bp_is_group() ) {//for single group
$post_id = false;
$group = groups_get_current_group();
$desc = $group->description;
if ( bp_is_current_action( 'forum' ) && function_exists( 'bbpress' ) ) {
$forum_ids = bbp_get_group_forum_ids();//we will get an array of ids
if ( $forum_ids ) {
$post_id = array_pop( $forum_ids );
}
if ( bp_is_action_variable( 'topic', 0 ) && bp_action_variable( 1 ) ) {
$topics = get_posts( array( 'name' => bp_action_variable( 1 ),
'post_type' => bbp_get_topic_post_type(),
'per_page' => 1
) );
if ( ! empty( $topics ) ) {
$post_id = $topics[0]->ID;
}
}
} //end of forum post finding
if ( $post_id ) {
$tmp_forum_desc = WPSEO_Meta::get_value( 'metadesc', $post_id );
if ( $tmp_forum_desc ) {
$desc = $tmp_forum_desc;
}
}
}//end of group section
return $desc;
}
add_filter( 'wpseo_metadesc', 'bpdev_bp_items_metadesc' );
/**
* New solution for BuddyPress SEO title
* (need to add "| Site.Com" in the end of the title on BP pages)
* Source: https://goo.gl/nC2WMW
*/
if ( ! function_exists( 'myarcadetheme_remove_bp_wpseo_title' ) && function_exists( 'wpseo_auto_load' ) ) {
function myarcadetheme_remove_bp_wpseo_title() {
if ( ! bp_is_blog_page() ) {
$myarcadetheme_front_end = WPSEO_Frontend::get_instance();
remove_filter( 'pre_get_document_title', array( $myarcadetheme_front_end, 'title' ), 15 );
}
}
add_action( 'init', 'myarcadetheme_remove_bp_wpseo_title' );
}
/**
* BuddyPress title separator
* Source: https://goo.gl/UV2tke
*/
add_filter( 'document_title_separator', function( $separator ) { return '|'; } );
These code snippets are working in file functions.php
with plugins:
Schema (breadcrumbs) also doesn't work on every buddypress page:
. Is something for future integration as well.
Opened internally: https://yoast.atlassian.net/browse/PRODUCT-187
Hi
I am using buddypress that comes with a newsfeed(activity) feature where a user can post something like facebook.
After a user posts on the feed with an image, I tried to share the posted news feed link to facebook. but facebook doesnt take the image from the post but the featured image of the ‘feed’ page.
Is there a way to assign an og:img metadata or og:titlte to each post on newsfeed whenever a post is made with an image in order for facebook to crawl the image when sharing the post link on the fb?
I posted this question in https://wordpress.org/support/topic/bbpress-post-image-for-facebook/#post-17044302 and was guided to follow this thread but it seems slightly different in sub issues detail.
Thank you
1- @AiratHalitov Are you code snippet still up to date with last version of Buddypress ? Buddypress does not have pages with shortcode any more but triggers URL without any access to content of page
2- Since Buddpress pages/URL are not pages any more, those pages are not in sitemap from Yoast Is i t part of integration in Yoast to have Buddypress URL in sitemap ?
3- In Yoast Settings > Content type, there is "Buddypress repository" Changes I make in meta title does not apply so far Has anyone tested and succeed to use meta title and description for "Buddypress repository"
@Johanwalter Just for my knowledge, where do you find Content type "Buddypress repository" in settings? I don't have such type listed though. did you install something?
@Johanwalter Just for my knowledge, where do you find Content type "Buddypress repository" in settings? I don't have such type listed though. did you install something?
@futureyoon I can see Buddypress Repository in Yoast SEO > Settings > Content Type I didn't install anything to get this menu I use template GWANGI There are plugins in GWANGI like "Grimlock for Yoast SEO" and "Grimlock for BuddyPress" I deactivated those 2 plugins, menu "Buddypress Repository" still display so it is not coming from one those 2 plugins I thought it was integrated in Yoast
SCREENSHOT
We need to investigate how we integrate with BuddyPress right now and what we need to do to make it better.
Sub-issues: