Search code examples
phpvue.jsseoprerender

vuejs prerendering with php dynamic content


I have a Question about prerendering a vue app built with php ( laravel or pure php it doesn't matter ) My question is how really prerendering work with dynamic content For example: when I make a blog with vue and php to show post I make Ajax Request in my vue app.. how google bots and other web crawlers will read my site content

Thanks in advance


Solution

  • The concept of prerendering is most used in SPA. It consists of rendering a placeholder or dynamic elements until the JavaScript code makes the necessary Ajax requests and uses the requested data to render new elements.

    You can use prerendering to server-side render the HTML that you want to make indexable for the search engines. Using PHP and Vue.js to achieve that can be complex because you need to have a view for the PHP template engine and another one for Vue.js. It can be difficult to maintain when the application grows.

    I've used hypernova to achieve that (Laravel and Vue.js). I wrote a couple of articles about it

    https://dev.to/phillipgd1992/universal-rendering-in-laravel-using-vue-js-and-ara-framework-5amd

    https://itnext.io/strangling-a-monolith-to-micro-frontends-decoupling-presentation-layer-18a33ddf591b

    You can read more about prerender, ssr, csr and universal rendering here:

    https://developers.google.com/web/updates/2019/02/rendering-on-the-web#seo

    Let me know if I can help you with something else.