How to set dynamic Meta Tags and Open Graph tags in polymer?

后端 未结 2 1938
伪装坚强ぢ
伪装坚强ぢ 2021-01-04 22:30

I have a polymer node site that I\'ve been working on and can\'t figure out how to include dynamic meta tags and Open Graph tags. Jquery won\'t work and neither will using t

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-04 23:13

    It's definitely an open issue, and it concerns any way to generate meta tags on the client side, whether it's Polymer or any other front-end code.

    It can be overcome only if the crawlers execute JS. On May 2014 Google started doing so. On the other hand, as far as I know Facebook has not moved in this direction yet.

    You might want to check out these other two answers to get a complete picture:

    • https://stackoverflow.com/a/16485238/570016
    • https://stackoverflow.com/a/25421037/570016

    As of today, the only 100% reliable way is for the server to intercept crawlers and specifically render content for them before sending the response. This is also knwon as isomorphic JavaScript. There already are some useful tools out there to support such tasks, like Prerender.

    Hope this helps! Cheers

提交回复
热议问题