The Open Graph Protocol is a new methodology for storing metadata to make it easier for third party sites (think the Facebook LIKE button) to identify relevant content on your page.
It looks like this:
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />
The开发者_如何学C question is, if you have multiple LIKE buttons on a page, each for a different article, how does one differentiate the Open Graph meta tags that belong to the article, not the page itself. Since the tags go in the HEAD is seems you only get one set per page.
Can Open Graph be "namespaced" or associated with content within the page, rather than the page itself?
As far as I know, you're stuck - but if you figure out a way, let me know!
I worked on a project that needed to have multiple Open Graph tags on a page - in the end, we ended up trimming down the number of items we needed OG for, so that we'd only have one story on a page.
All I can think of is using <iframe>
.
Each article is gonna have its own page, suitable to be placed inside another page.
And then you can display all those articles inside the master page.
If each like button is associated with an item on the same page, then header of each item could link through to a page for just that item. That page could carry all the meta tags for the item and like button would use the url of that page. I did this here http://cinema-shorts.org/past/ (P.S. this is the first proper website Ive built so if its broken please forgive me)
Each object is represented by a unique URL so, no, multiple objects cannot exist on a single page.
You can have multiple like buttons on one page, but each must be set to point at a different URL by using the href
attribute.
You can make each of your object urls do a JavaScript redirect (window.location.href = new_url) to make users who arrive at each of your object pages be redirected to a single user-visible page.
精彩评论