Hi Tobias,
This looks pretty neat, actually. I'm guessing that you primarily want to have the like option show up in your articles, correct? There are a few ways you could do this. The easiest would be to simply manually add the meta code to the relevant template file -- for articles, that would be templates/article/header.tpl, for the main site header that would be templates/common/header.tpl (or lib/pkp/templates/common/header.tpl in OJS 2.3+).
You'll want to dynamically print relevant article information within the meta tags, as well, for example, abstract text in the "og:description" meta field, which you should be able to do by using the following Smarty variable:
- Code: Select all
{$article->getLocalizedAbstract()|strip_unsafe_html|nl2br}
(That IIRC may not work in OJS 2.2.x -- let us know.)
Then you'll want to add the code for the Like button to one of the templates/article/... template files, depending on where you want it to show up. That should be fairly straightforward.
You could probably also do this as a system plugin. Take a look at some of the generic plugins and their code to get an idea on how to do this. For example, the generic/coins plugin and generic/googleAnalytics both add information to page footers. You can adapt these methods to add information to the page header.
If you have any specific questions, please let us know. If you do end up going the plugin route, we'd be happy to help; and also would be very happy if you were willing to share the plugin with the community.
One final note -- if you do manage to upgrade to a more recent version of OJS, you will find that there is now an "addThis" option available for journals, which allows for easy social sharing of articles online. See
http://www.addthis.com/ for more information.
Cheers,
James