2

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 2

2

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.

3
  • 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)
    – Steve
    Commented Mar 11, 2017 at 4:22
  • Google's pretty on top of things.
    – wogsland
    Commented Mar 12, 2017 at 17:55
0

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.