Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite scroll SEO #6598

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

kontrollanten
Copy link
Contributor

@kontrollanten kontrollanten commented Sep 20, 2024

Description

Adds a "Load more" button on the bottom of MyInfiniteScrollerComponent. For a regular user the behavior should be the same.

Behavior for bots:

  1. Loads the page and InifniteScroller will continue to load more content until the visible part of the page is full.
  2. In the bottom the bot will see a link to page?{currentPage++}
  3. Upon visiting this link the scenario will be repeated.

Background

Thoughts during the path

  • Skip the scroll logic and instead use IntersectionObserver to trigger "near bottom" when the Load more button becomes visible.
  • I began to add pagination URL query params upon scroll, but this went too complex. Maybe it can be nice for users to be able to link directly to a paginated page, but it's out of scope for this feature.
  • When watching a video in a playlist the query params will affect both the playlist and comments. Not ideal, but will only affect bots.

Todo

  • Add page query param to the canonical URL for pages where the main content is paginated. For other paginated pages (i.e. comments, watch playlist, etc) the canonical URL shouldn't include the page query param.

Related issues

#6332

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this PR does not update server code
  • 🙋 no, because I need help

To test it manually, add a "?page=1" query param to a route which has infinite scroll

Screenshots

@kontrollanten kontrollanten marked this pull request as draft September 20, 2024 19:04
@kontrollanten kontrollanten force-pushed the feat-6332-infinite-scroll-seo-2 branch 2 times, most recently from ad1d2d6 to b620bea Compare September 24, 2024 10:12
@kontrollanten kontrollanten marked this pull request as ready for review September 24, 2024 10:44
@kontrollanten
Copy link
Contributor Author

@Chocobozzz I did a self-review and found some minor style changes. If you're okay with this implementation I'll fix them.

@kontrollanten
Copy link
Contributor Author

@Chocobozzz Any thoughts on this? If this feature is wanted I'll do a cleanup and fix merge conflicts.

@Chocobozzz
Copy link
Owner

Any thoughts on this? If this feature is wanted I'll do a cleanup and fix merge conflicts.

We're interested in the feature but unfortunately we don't have time to review it yet

@kontrollanten kontrollanten force-pushed the feat-6332-infinite-scroll-seo-2 branch 2 times, most recently from 812fa93 to b9dadbf Compare October 23, 2024 11:22
Add a "Load more" button in the bottom to help search engine bots to
navigate to the next page. In order to debug this functionality, add
?finiteScroll=true to the URL.
hasMoreItems has to be called before bumping the current page in order
to work accordingly.
@kontrollanten kontrollanten force-pushed the feat-6332-infinite-scroll-seo-2 branch from b9dadbf to 1ac7373 Compare October 23, 2024 11:42
@kontrollanten kontrollanten force-pushed the feat-6332-infinite-scroll-seo-2 branch 2 times, most recently from c7a1037 to 66db1ea Compare October 23, 2024 12:41
@kontrollanten kontrollanten force-pushed the feat-6332-infinite-scroll-seo-2 branch from 66db1ea to 1066288 Compare October 24, 2024 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants