iamSahdeep / seo_renderer

A Flutter Web Plugin to display Text Widget as Html for SEO purpose
MIT License
114 stars 15 forks source link

Use isbot package to detect robot #15

Closed krokyze closed 2 years ago

krokyze commented 2 years ago

Potentially it could be better to use something like this https://www.npmjs.com/package/isbot to detect the robot:

<script>
  if (isbot(navigator.userAgent)) {
    window.flutterWebRenderer = "html";
  }
</script>

And pass simple boolean down to RobotDetector dart code, just that I'm not that familiar with NPM and how to use it within html.

iamSahdeep commented 2 years ago

@krokyze Is it for users to enable html as web renderer? Or should we use it to detect bot? internally it seems like this package is also using regexp from list of predefined bots mentioned in the list here https://github.com/omrilotan/isbot/blob/main/src/list.json

krokyze commented 2 years ago

@iamSahdeep yep that would then be used to detect the bot, and we wouldn't need to have the same regex in dart code.

clragon commented 2 years ago

adding a package like that to a flutter web project sounds tedious; borrowing their regex list would be quite easy though.

krokyze commented 2 years ago

adding a package like that to a flutter web project sounds tedious; borrowing their regex list would be quite easy though.

I feel copy pasting one of 100 available StackOverflow solutions is not ideal as no one has time to keep track of new robots appearing.

But as after some discussions in #1 seems like robot detection isn't quite valid solution so I'm closing this idea.