In my ruby on rails app, I'm showing multiple paginated items on a single page. For a single items pagination, I know how to use pagination and rel='prev'
and 'next'
attributes and canonical. But in my case, there can be multiple permutations and combinations of a page and this confuses me. From a user's perspective in my case, he/she'll be happy to see different types of information regarding an object on a single page and paginations. But, from a search engine's perspective, it's not that friendly and may cause partial duplicate content. My intention is to get ranked for the index page and google to find the content from the index and paginated pages. Some of these items are accessible from other pages as well in different listings on the separate page. And I also intend to make a sitemap.xml file.
So I have following options:
Keep only index page in the index and make rest of the paginated pages in noindex using robots meta tag.
Use canonical URLs from the request URL and do not use rel='prev' and 'next', because otherwise it'll cause say 10x10= 100 variations of the page if each item has 10 paginated pages.
- Use canonical URLs and rel='next' and 'prev' for one of the paginated items and ignore the rest of the URLs or use noindex meta tag for rest of the URLs. I'm leaning toward this solution. So it'll effectively make one pagination on my page and rest of URLs won't interfere with it.
- Or I should only use a single
page
parameter and use that to paginate all other paginated models as well. And when one of the items doesn't have any more pages I should show content from the last page for that item and paginate other items. But I don't know how can I do that using Kaminari? As of now, I'm using three different page_param to paginate these models. I think it'll be the preferred and better solution.
Here is my current code:
def show
@state = State.published.friendly.find(params[:id])
@cities = @state.cities.published.sorted.page(params[:page]).per(10)
@events = @state.events.published.sorted.page(params[:cities_page]).includes(:cities).per(10)
@articles = @state.articles.published.sorted.includes(:user).page(params[:articles_page]).per(10)
add_breadcrumb 'States', states_url
add_breadcrumb @state.name, @state
end
And cities page has two paginated items, events and news articles from that city. I'm showing these three paginated items using tabs.