Skip to:
Content

Opened 12 months ago

Last modified 10 months ago

#4981 new enhancement

Regenarate url's in Rel Next/Prev According buddypress pages

Reported by: megainfo Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version: 1.7
Component: All Components Keywords:
Cc:

Description

In all Byuddypress pages, the rel='next' and rel='prev' are generated by wordpress.

it would be interesting to regenarate them according the current buddypress page.

Change History (10)

comment:1 r-a-y11 months ago

Here's some documentation on prev / next:
http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#link-type-next

I think this issue becomes more prevalent with BP 1.7 due to the theme compat layer.

However, in order to generate these links we'd need to query for them.

For example, if I'm on an activity permalink page, we'd need to query for the previous and next activity item for that user.

It's a big job for little gain.

My opinion is we should remove these prev / next links when on a BuddyPress page.

comment:2 boonebgorges11 months ago

My opinion is we should remove these prev / next links when on a BuddyPress page.

For most BP activity types (groups, users, etc), the concept of "previous" and "next" items doesn't really make sense anyway. So IMO it definitely makes sense to remove them in these cases. For activity permalinks, it does make sense to have such links (I suppose), but r-a-y is right that it may be a lot of work for a marginal benefit. So, until someone's taken the time to implement it, maybe it makes sense to remove them here too.

Is there a theme-independent way to remove the links? (too lazy to look)

comment:3 r-a-y11 months ago

  • Milestone changed from Awaiting Review to 1.8
  • Version set to 1.7

Is there a theme-independent way to remove the links? (too lazy to look)

Yup, they are basically hooked into 'wp_head'. If we are to remove them, should this code go into the BP_Legacy class? I think that's the most logical place for this.

Tentatively moving to 1.8.

comment:4 megainfo11 months ago

Hi @boonebgorges, @r-a-y

Im agree with you @boonebgorges to remove these prev / next links when on a BuddyPress page. By adding this code somewhere in buddypress core.

function _bp_maybe_remove_adjacent_posts_rel_link_wp_head() {
  if ( ! bp_is_blog_page() && ! is_404() ) {
  	remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
  	add_action( 'bp_head', 'bp_adjacent_rel_link_wp_head' , 1);
  }	
}
add_action( 'wp_head', '_bp_maybe_remove_adjacent_posts_rel_link_wp_head' , 1 );

But I suggest adding rel="next" and rel="prev" in pagination in all buddypress components (members, groups, activity, messages,...etc).

Check this video that talk about SEO and Pagination :
http://www.youtube.com/watch?d&v=njn8uXTWiGg

This can be done by adding a filter to paginate_links wp function :

add_filter('paginate_links', 'bp_add_rel_next_prev_paginate_links',10 , 1 );
function bp_add_rel_next_prev_paginate_links( $pag_links ) {
	$pag_links = str_replace( '<a class="prev ', '<a rel="prev" class="prev ', $pag_links );
	$pag_links = str_replace( '<a class="next ', '<a rel="next" class="next ', $pag_links );

	return $pag_links;
}

comment:5 boonebgorges11 months ago

megainfo - Thanks for the first function. At a glance, that seems reasonable.

As for the second idea, I like the thought of including rel="prev" etc, but there must be a better way to do it than doing a str_replace(). I don't have time to research it in detail at the moment, but isn't there a way to tell paginate_links() to include these attributes? If not, shouldn't we be offering an upstream patch, since this would make sense for WP too?

comment:6 megainfo11 months ago

There is no filter in paginate_links()or param to include these attributs,

i think we need to suggest to wordpress team to add a filter (or a rel="next" rel="prev" attribut to the href with next and prev class).

Last edited 11 months ago by megainfo (previous) (diff)

comment:7 megainfo11 months ago

I forget to suggest adding rel="next" to "load more" href in bp default and compact theme.

comment:8 boonebgorges11 months ago

i think we need to suggest to wordpress team to add a filter (or a rel="next" rel="prev" attribut to the href with next and prev class).

Yes. If you open a ticket, please link to it from this thread.

comment:9 megainfo11 months ago

I was open a ticket in wordpress trac

https://core.trac.wordpress.org/ticket/24375

comment:10 boonebgorges10 months ago

  • Milestone changed from 1.8 to Future Release
Note: See TracTickets for help on using tickets.