Reputation: 1727
I've got an AngularJS
web app, which is basically running totally on the client side of course.
I need to add html meta tags
for the FaceBook
scraper, which of course needs it rendered from the server, and not from any client-side java-script.
So far I've done this using two different addresses :
So if someone surfs to mysite.com/products/1234
He will get the FaceBook meta tags and a redirect to mysite.com/products2/1234
,
which is the client side app.
Of course this is not pretty and also when people copy-paste the link on their screen in FB - it won't find any meta data.
My App is AngularJS
, server is NodeJS
.
Is the only way to go server-side-rendering of the whole app page ?
I'd really love to keep client-side and server-side logic and code separate.
Thanks
Upvotes: 2
Views: 1165
Reputation: 412
I'm not familiar with node.js (yet :) ) but I'm pretty sure that you can check that a request is an XMLHttpRequest or not. If it is you send back the data for the ajax call if not you render the whole page.
Upvotes: 0