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

Lazy-loading & SEO for hidden carousel elements #1469

Open
oyeanuj opened this issue Dec 23, 2018 · 6 comments
Open

Lazy-loading & SEO for hidden carousel elements #1469

oyeanuj opened this issue Dec 23, 2018 · 6 comments

Comments

@oyeanuj
Copy link

oyeanuj commented Dec 23, 2018

Hi folks! Thanks for maintaining this port!

So, I am using this in a server rendered context to show a list of clickable cards. Now with Lazy loading, it doesn't create those components on initialization which would affect SEO for the page since those card links aren't discoverable.

Is there any way to have SEO not suffer in such a case? If not, would you consider adding a placeholder prop which renders a placeholder component for lazy loading cases?

If we do that, I imagine line 113 below would need to change to instead render the placeholder component:

react-slick/src/track.js

Lines 106 to 114 in 48c93ed

// in case of lazyLoad, whether or not we want to fetch the slide
if (
!spec.lazyLoad ||
(spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0)
) {
child = elem;
} else {
child = <div />;
}

@oyeanuj
Copy link
Author

oyeanuj commented Dec 23, 2018

Another option if this should be solved in the userland is to provide a renderChild method for the children items that is called with a flag like isVisible. In that case, the placeholder logic can be shifted to the user.

Thoughts @akiran @laveesingh @maddhruv?

@lucashfreitas
Copy link

I am facing the same issue using SSR. Did you find any solution for that @oyeanuj ?

@lucashfreitas
Copy link

lucashfreitas commented Jan 22, 2019

@oyeanuj I solved this problem setting sliderContent lazyLoading property to false. Now all the slides contents are being rendered for SEO.

const settingsSliderContent = { dots : false, lazyLoad : false, infinite : false, arrows : true, fade : true, speed : 500, slidesToShow : 1, slidesToScroll: 1, swipeToSlide : false, accessibility: true,

@oyilmaztekin
Copy link

@lucashfreitas Providing a placeholder content rendered by the server while the original content is progressively loading is a good example. That is why @oyeanuj suggested adding a placeholder prop as a feature. Setting lazyload property as a false also prevents progressive loading. Rendering small-sized placeholder content by the server for SEO purposes also loading original big-sized content progressively... or similar solution that we expected.

@debjits1
Copy link

debjits1 commented Oct 11, 2022

@oyeanuj @oyilmaztekin I am facing the same issue. Googlebot does not crawl the lazyloaded items, also I don't render the slides at SSR. Can anyone help me here?

@adamjez
Copy link

adamjez commented Mar 14, 2023

I'm facing the same issue too. The behavior changed in the version 0.27.1: 8ae0e38

Behavior before version 0.27.1: Initial slide was rendered even with lazy loading enabled in server-side rendering.

Behavior in version 0.27.1 and forward: No slide is rendered with lazy loading enabled in server-side rendering.

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

No branches or pull requests

5 participants