Detect Crawler and load Template from server

211 Views Asked by At

I am new in VUE JS.

I have project detail page. For social sharing there will be dynamic values for meta tags e.g og:title or og:image. I am able to set the meta tag values. But when I check on facebook debugger it took the old/default meta content. From this link i get to know that need to check the user agent and then the load template accordingly.

But how we can do it in VUE JS? Thanks in Advance.

1

There are 1 best solutions below

0
On

If you want to dynamically set meta tags like og:title or og:image you may want to consider doing it from backend code so that the dynamic tags are in place when the html is sent to the browser. The reason for this is that some crawlers do not run javascript code. For any crawler that does not run javascript code, setting such meta tags via a clientside library like Vue.js will not affect what the crawler sees since it will only see the html as it existed when originally streamed from the server.