Documentantion for building new metadata plugin

Hi, I want to build a new plugin for adding social network metadata (twitter cards and open graph initially), but I can’t understand how the metadata plugins work, is there some documetation for building metadata plugins?

Hi @cccaballero,

That’s documented here:
https://pkp.sfu.ca/wiki/index.php?title=Metadata_and_Filter_Framework

…but if you can describe what you’d like to do, maybe I can provide additional information.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher.

I am working with some journals, and I want to include some social media meta tags (open graph and twiiter cards initially) and I want to build it as a plugin.

Hi @cccaballero,

I might suggest working with a generic plugin, not a metadata plugin. You could look at something like the OpenAIRE plugin (plugins/generic/openAIRE) for an example of a plugin that uses article_settings to store additional article level metadata.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher, thank so much.

I seen the OpenAIRE plugin an now I know how to proceed, but the “Dc11SchemaArticleAdapter::extractMetadataFromDataObject” hook seems to be only for articles pages, how can I add meta tags to other pages like the journal index?

And now a personal thought:

Will not be good a “addMetadata()” function in the OJS framework as other frameworks have?

Hi @cccaballero,

If you want to add content to the journal index page, you’d use something like either the LoadHandler hook or the TemplateManager::display hook. See the Lucene plugin for examples of each.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher

Yes, using the $additionalHeadData variable seems to be the easiest way. But is the good way?

Hi @cccaballero,

I’ve basically declared a moratorium on improvements to the OJS 2.x plugin API, as we’re working heavily on OJS 3.0 and there are already some basic improvements made there. I’d rather that we invested design effort in improving things on the master branch. So for now, I’d suggest using $additionalHeadData if that suits your needs.

Regards,
Alec Smecher
Public Knowledge Project Team

Yes, it is logical to work harder for the future versions, I will work using the $additionalHeadData variable until the new API and OJS version are released.

Many thanks.

Hi @asmecher.

I just finished a first version of the social metatags plugin. I uploaded the project to github (GitHub - daxslab/ojs-social-metatags: Adds Open Graph and Twitter Cards meta tags to Open Journal System Journals) so everyone can download it.

Regards.

2 Likes