Creating Objects With The Facebook Open Graph Api
Solution 1:
You cannot set meta tags dynamically with Javascript before Facebook scrapes them. You must do it from server side. However, what you want to accomplish here doesn't require you to use the Facebook SDK. Here is a PHP example on how to do it: Generating Facebook Open Graph meta tags dynamically I'm sure you can transfer that code into Python.
Solution 2:
When the Facebook crawler hits the URI representing and identifying your Open Graph object (say, a chemical), it will parse the OG tags and store that data with the URI as an identifier.
As such, you would have a URI http://example.com/chemicals/1 render
...
<metaproperty="og:title"content="Potassium Nitrate" /><metaproperty="og:description"content="totse.com was really cool" />
...
and http://example.com/chemicals/2 render
...
<metaproperty="og:title"content="Whateverium Sulfate" /><metaproperty="og:description"content="This makes things go boom." />
...
To make this clearer, here's what's happening. This is a dynamic page, which responds to the number at the end of the URI as a parameter for querying your chemical database: (ERB example).
...
<metaproperty="og:title"content="<%= @chemical.name %>" /><metaproperty="og:description"content="<%= @chemical.description %>" />
...
Post a Comment for "Creating Objects With The Facebook Open Graph Api"