Is there any way to change meta tag from the source code with vue js?
As you all know Vue js works in template. So it load the content the the page dynamically. so there is no way to change the meta tags manually. So there is a package called vue meta which is used to change the meta tags of the vue page dynamically. But the problem is when I change the meta tag dynamically It only changes in the inspect. But when I open the page source it isn't changing there.
I even tried server side rendering for this. Is there any solutions??
@sajidalislam Changing a meta tag in Vue is going to have no real effect. It’s just like opening web inspector and tweaking your web page there; the changes are only made client-side.
Your server needs to return the meta tags you want the browser to see. So yes, you’ll need to do server-side rendering and have the meta tags set to the values you want before it’s sent to the browser.
@martinbean But I tried Server side rendering with vue meta but it still isn't working. Note: I used laravel for backend, and i set the meta for each page dynamically from the backend
@SajidAlislam i think using ssr or nuxtjs is the best way to do what you want otherwise anything you do only by vue is non sense as it will only appear to user that he have meta tag or description but if we consider google crawling spiders they wont see any of this
There was nothing to do for me, because I am working for a company and the app was built before i joined using vue js with another team. Now I am In charge to maintain and improving the site,
so that's why i am facing the issue
@SajidAlislam Well there’s no magic answer here. If SEO is important then you either need to add server-side rendering, or re-build the app to use a different tech stack for the front end that is more search engine-friendly.