I am building a single-page-application/SPA that uses JavaScript to control all the pages. Naturally, this means only one meta description embedded in HTML, even though there are many different pages with different descriptions across my site. I know it's possible to modify the description meta tag with JS, but will it affect google? Is there any other way to control the description dynamically like this?
2 Answers
According to a quick search for "does google search process javascript" this result seems to answer your first question.
Is there another way? Yes, use PHP to build your meta tags dynamically, then they are created before the page is even served.
-
Thank you. Also, PHP is not the only server-side lanugage ;) Commented Mar 11, 2017 at 3:58
-
I know that, but it is pretty much ubiquitous and I didn't say it is the only way ;o)– SteveCommented Mar 11, 2017 at 4:22
-
Google indexes JavaScript just fine. What you do is not a popular way of changing the meta description but that might be an advantage for you. I would stick with your method!