“Single-page” JS websites and SEO

后端 未结 9 1769
春和景丽
春和景丽 2020-11-30 16:13

There are a lot of cool tools for making powerful \"single-page\" JavaScript websites nowadays. In my opinion, this is done right by letting the server act as an API (and no

9条回答
  •  感情败类
    2020-11-30 16:50

    This might help you : https://github.com/sharjeel619/SPA-SEO

    Logic

    • A browser requests your single page application from the server, which is going to be loaded from a single index.html file.
    • You program some intermediary server code which intercepts the client request and differentiates whether the request came from a browser or some social crawler bot.
    • If the request came from some crawler bot, make an API call to your back-end server, gather the data you need, fill in that data to html meta tags and return those tags in string format back to the client.
    • If the request didn't come from some crawler bot, then simply return the index.html file from the build or dist folder of your single page application.

提交回复
热议问题