TradeMe / ng-defer-load

MIT License
127 stars 37 forks source link

Media not visible for GoogleBot #38

Closed workindo-coder closed 4 years ago

workindo-coder commented 4 years ago

I implemented the package exactly as described in this example: https://www.npmjs.com/package/@trademe/ng-defer-load

It works fine when I scroll over my website but it looks like the google bot does not see the images. Is this a known issue? Or am I doing something wrong?

mzoellner commented 4 years ago

The googlebot likely does not do any scrolling, so it likely won't cause any intersection observer events to happen.

Closing this, as there is not a lot we can do about it.

phenomnomnominal commented 4 years ago

You could detect that the user agent is googlebot and have a flag like forceRender?

public ngOnInit () {
    if (this.forceRender || (isPlatformServer(this.platformId) && this.preRender === true) || (isPlatformBrowser(this.platformId) && this.fallbackEnabled === false && !this.hasCompatibleBrowser())) {
        this.load();
    }
}
mzoellner commented 4 years ago

Yeah that could work. Then you can control from the outside if you want to always fire the deferLoad event in certain scenarios (e.g. userAgent is google bot) Happy to re-open this, if you want to provide a PR for it @workindo-coder