Open Graph Protocol in Backbone Application
Asked Answered
M

1

16

I have a backbone application built on an Express JS API and Backbone JS frontend.

Every model and collection, thus consumes from the API, and I render them into the templates provided by a backbone view.

My attempt is this : Everytime the route changes (In turn, rendering a new view) I would like to change contents of the header tag - OGP related content, twitter cards, meta tags that help in SEO. I am not asking how to implement this, but this is the plan.

Are rumors true that OGP will not work this way? Do client side apps have no chance of having OGP entries which are dynamically changed by routes?

If yes, how should I change the way the app behaves without completely changing to server side rendering?

Moffat answered 30/10, 2015 at 7:0 Comment(1)
Check this post if you haven't already: #8897273Postmortem
R
1

Most OGP libraries will only parse HTML and not execute JavaScript. So the only way to go is server side rendering.

React has libraries like Helmet which helps with this. You can take inspiration from it to build it on Backbone.

Routinize answered 21/9, 2016 at 10:44 Comment(1)
One Year Later >>> Moves to React Redux server side rendering. HEHEHE.Moffat

© 2022 - 2024 — McMap. All rights reserved.