Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
Hi I have a question.
Is this module SEO friendly? Like described in this Google article: http://googlewebmastercentral.blogspot.com.es/2014/02/infinite-scroll-se...
<link rel="previous" href="/view-path">
<link rel="next" href="/view-path?page=1">
And does it leave the regular pagination GET parameters working? ?page=XX
Thank you!
Jérémy
Comment | File | Size | Author |
---|---|---|---|
#22 | views_infinite_scroll-2283415-22.patch | 2.11 KB | osopolar |
#21 | views_infinite_scroll-2283415-21.patch | 2.09 KB | peterhebert |
#19 | interdiff.txt | 651 bytes | basvredeling |
#19 | views_infinite_scroll-2283415-19.patch | 1.91 KB | basvredeling |
| |||
#17 | make_views_infinite_scroll_seo_friendly-2283415-17.patch | 1.69 KB | peterhebert |
|
Comments
Comment #1
heyyo CreditAttribution: heyyo commentedI'm also interrested in this feature. Any update on this ?
Comment #2
ryan88 CreditAttribution: ryan88 commentedI believe if you do a view source of a page using this module, you will find the next and previous links there, and appending ?page=1 to the url will properly load the second page of results. As far as I know, this module is SEO friendly.
Comment #3
glass.dimly CreditAttribution: glass.dimly commentedNo. It does not add rel="prev" and rel="next", nor, for that matter, does stock views pagination: https://www.drupal.org/node/1567684#comment-11267519
Comment #4
milodescI'm attaching a patch for version 7.x-1.1 of the Views Infinite Scroll module that should provide a solution for some cases (it won't work as expected if you've got a page with more than one infinite scrollers).
It is based on nlisgo's Next Prev Links sandbox module, which is discussed here.
It's not a perfect solution, but hopefully can give someone a head start on a better solution.
Comment #5
kmontyComment #6
mvdve CreditAttribution: mvdve commentedViews infinite scroll is still not very SEO friendly in Drupal 8. The related issue suggest adding the metatags to views core which looks like a better solution.
Comment #7
mvdve CreditAttribution: mvdve commentedI looked in to this and decided to create a patch for the infinite scroll module. There are to many questions to get this resolved in core within short notice.
The attached patch solves the issue for D8. The question is how to handle which view should set the tags. The patch only works with views page displays. This could be an issue when a block is used for the main content.
Comment #8
Sam152 CreditAttribution: Sam152 at PreviousNext commentedThis should probably be a generic views contrib module and not live in VIS. VIS is a fairly light alteration to the core ajax pagination, so I think a generic solution for views ajax pagination would just work when VIS was enabled.
Comment #9
kmontyI don't know enough about this, but can someone verify this is an SEO bug with Views? If so, maybe we should move this ticket to the View issue queue (can be done by editing the Project in Issue metadata) instead of labeling this as working as designed?
Comment #10
kmontyAlso, this is perhaps a duplicate of #1567684: Adding rel="next" and rel="prev" metatags to paginated views pages, however some commenters have suggested that there is a unique issue that requires patching VIS directly.
I haven't looked into the code for patching this (found another workaround that isn't worthy of submitting as a patch). Will let others be the final judge of this...
Comment #11
AMDandy CreditAttribution: AMDandy commentedIn addition, should the Show More link have a rel of nofollow as well as next? We noticed spurious links being indexed with Google that shouldn't be.
Comment #12
bcdev CreditAttribution: bcdev commentedA slight change to add code to scrub "user" input and make sure we don't get any SQL injection.
Comment #13
superbiche CreditAttribution: superbiche as a volunteer commentedHere's a reroll of #7 but adding
<link>
tags inhtml_head_link
rather thanhtml_head
Comment #14
KoolAidGuy CreditAttribution: KoolAidGuy commentedI tried using the patch in #13 and am seeing two issues.
1) The new code to create the rel tags will only fire if the view is on a page, so any views displayed in a block with the infinite scroller will not work.
2) Due to the Ajax nature of the typical use of the infinite scroller, I'm only seeing the correct rel=next on the first page. Subsequent pages do not reload and so hook_page_attachments does not have a chance to run.
I'd suggest adding and/or updating the link-rel tags be done in the javascript code. I'm working on a patch to add to this thread.
Comment #15
KoolAidGuy CreditAttribution: KoolAidGuy commentedHere's a patch to add the SEO tags via AJAX.
Comment #16
omnia.ibrahim CreditAttribution: omnia.ibrahim commentedTried patch #15, it didn't work, there is not prev tag added and the next is not updated
Comment #17
peterhebert CreditAttribution: peterhebert at CoLab Cooperative commentedre-rolling patch #7 to work with 8.x-1.7
Comment #18
basvredeling#17 works but introduces 2 deprecated functions. This attached patch resolves that.
Comment #19
basvredeling2 changes from previous patch:
Comment #20
PieterDCThe article referenced in the issue description https://webmasters.googleblog.com/2014/02/infinite-scroll-search-friendl... does indeed mention prev and next links in the HTML head to create, what they call "a paginated series (component pages) to go along with your infinite scroll".
The patch from comment #2283415-19: Make Views Infinite Scroll more SEO friendly only adds those links for the first page, which was pointed out earlier by #2283415-14: Make Views Infinite Scroll more SEO friendly and fixed by #2283415-15: Make Views Infinite Scroll more SEO friendly but the patch doesn't apply as mentioned by #2283415-16: Make Views Infinite Scroll more SEO friendly
As far as I understand, such thing is not need for a Google Bot, assuming it doesn't use Javascript, it will follow the link (as if clicked) and causes a new page request, generating the correct links.
I encountered the issue that the patches only work for Views page display, not block displays, as mentioned by #2283415-7: Make Views Infinite Scroll more SEO friendly. I haven't tried #2283415-15: Make Views Infinite Scroll more SEO friendly in that aspect, but from what I read in https://www.drupal.org/project/pager_metadata views_infinite_scroll_preprocess_block() probably won't do the trick on its own.
I tried a different approach, which is rendering the full pager in the background, so pages after the next page are less deep in the navigation structure (and considered more important by Google) #3183015: Extend the full pager.
Doing so, other modules like https://www.drupal.org/project/pager_metadata , that are tested to work with Drupal core's default pagers, have more chance to be compatible out of the box.
So a combination of https://www.drupal.org/project/pager_metadata and #3183015: Extend the full pager can make the patches from this issue redundant. Up to you to choose your prefered approach.
Comment #21
peterhebert CreditAttribution: peterhebert at CoLab Cooperative commentedPatch for 8.x-1.x contains a deprecated function pager_query_add_page(), which was in drupal:8.8.0 and is removed from drupal:9.0.0.
Use \Drupal\Core\Pager\PagerManagerInterface::getUpdatedParameters() instead.
On Drupal 9, using the patches on this issue returned fatal error:
I have re-rolled the patch to use the new PagerManagerInterface via : \Drupal::service('pager.manager');
Tested with both branches 8.x-1.x and 2.x on Drupal 9.3.9, and works to fix the error in D9, while maintaining the SEO functionality.
Comment #22
osopolarPatch from #21 with following modification to not set pager like
page=0
:- $element = $pager_manager->getUpdatedParameters([], $pager->getPagerId(), $current - 1);
+ $element = $current > 1 ? $pager_manager->getUpdatedParameters([], $pager->getPagerId(), $current - 1) : [];
Comment #23
AnybodyThanks for the important work on this. I think this now needs to be fixed in 2.0.x-dev and therefor needs a reroll. Furthermore it would be super helpful to have tests to ensure it works as expected
Comment #24
AnybodyWe should please have tests for this and it would be great, if someone could test this manually before. Thanks!