Indicating paginated pages with rel=“next” and rel=“prev”


Does anyone know how to indicate rel=“next” and rel=“prev” on paginated pages? Failing that, a way to tell Google the primary URL for a paginated page using a canonical tag?

I know I can add a custom field on a CMS page to achieve canonical, but then your canonical tag would also be on the primary page. Would that matter?


1 Like

I just faced this issue, fortunately, I know a little bit of jquery and can fix it through custom code. I’ll post the code once I figure out something

There you go!

	var prev_link = window.location.origin + window.location.pathname + $('.w-pagination-previous').attr('href');
	var next_link = window.location.origin + window.location.pathname + $('.w-pagination-next').attr('href');

		prev_canonical =  "<link rel='prev' href='" + prev_link.toString() +"' />";

		next_canonical =  "<link rel='next' href='" + next_link.toString() +"' />";
1 Like

thanks @alevikx

Did you place this in the ?
Do you have a site that has this example live?