apparentlymart / angularjs-viewhead

Change the HTML title and head elements on a per-view basis
http://apparentlymart.github.io/angularjs-viewhead/example/
MIT License
98 stars 19 forks source link

Can I use this to dynamically set og metatags without a pre-render server? #15

Open kchima opened 8 years ago

kchima commented 8 years ago

Hello,

I apologize for creating an issue for this, but I couldn't figure out another way to contact you. I see in the example a dynamic og metatag, but I don't understand how this could be. Facebook interprets these tags without executing javascript, so how would Facebook be able to interpret this? My goal is to have dynamic metatags on Facebook / Twitter / Google without having to create a pre-render server and all that headache.

Thanks very much, -Keith Chima

apparentlymart commented 8 years ago

Keith,

As you suspected, this module alone can't help with the fact that AngularJS code normally runs only for clients that are able to run JavaScript. The idea is that you'd use this module in conjunction with some kind of server-side rendering solution, so that when a page is prepared for a robot it will have the necessary meta tags in it without any further transformation.

Completely agreed that server-side rendering is a headache! If the meta tags are the only thing you care about for robots, it'd undoubtedly be easier to just render your bootstrap HTML dynamically on the server and include the meta tags in it from there, rather than trying to do it from within AngularJS code.