WordPress shortcodes for DOIs and other research links

Standard

I’ve writ­ten a plu­gin for WordPress that adds short­codes to link to research. To use it you’ll need a self-installed WordPress blog. A blog at word​press​.com won’t be able to use it.

[doi id=“10.1093/aob/mct148”]link text[/doi] links the link text to http://​dx​.doi​.org/​1​0​.​1​0​9​3​/​a​o​b​/​m​c​t​148 It also does a few more things.

If there are research codes used, the blog checks to see if it has cita­tions stored for them. If it does then it out­puts a References sec­tion at the end of the post. It’s not in this post, because I’m not actu­ally using the short­code in this post.

If there isn’t a cita­tion stored, the blog will go through each DOI and make one. It’s designed to make cita­tions com­pat­ible with the ScienceSeeker web­site. If you’re a sci­ence blog­ger then you would do well to sign up to this.

It solves a prob­lem with alt­met­rics too.

At AoB Blog we post about vari­ous papers, usu­ally from Annals of Botany or AoB PLANTS. If people like what they see and tweet a link to the post, the post gets credit for the link, but the ori­ginal paper doesn’t. It wasn’t the ori­ginal paper tweeted, it was the post. I’ve talked with people at OUP and Altmetric​.com and the answer we settled on was to add a meta tag in the header.

<meta name=“DCTERMS.isBasedOn” scheme=“DCTERMS.URI” content=“http://dx.doi.org/10.1093/aob/mct148”/>

This gives a way to con­nect a post to the paper it’s com­ment­ing on. It only works from the second time a page is loaded, but the first is usu­ally a pre­view by the author, so that’s not critical.

Not everything people want to link to has a DOI. What do you do if you have a mix of DOI and http:// links and you want to use them in the same ref­er­ence sec­tion? There is a url shortcode.

[url id=“http://aobblog.com/2013/08/brachypodium-is-not-arabidopsis/” author=“Chaffey, N.” date=“2013” title=“Brachypodium is NOT Arabidopsis(!)” website=“AoB Blog”]

…will out­put a cita­tion in a sim­ilar style to the DOI cita­tion, with a ‘date accessed’ note added, set to whenever you first run the short­code. If you don’t spe­cify a pub­lic­a­tion date then it sets this year. If you don’t spe­cify an author then it is set to ‘Unknown’.

You can down­load the code from Dropbox and install it, or have a laugh the at code. The code is not sleek, because I wanted to see what was hap­pen­ing each step of the way. As a warn­ing, I don’t know if this is secure code or not. That’s not likely to be a big prob­lem if it’s just you on your site, but it’s an issue if you have a multi-author blog.

Also it doesn’t handle a few other things yet. There is a space for an [arxiv] short­code. I haven’t added this yet because arxiv out­puts metadata in a dif­fer­ent way to dx​.doi​.org. Despite hav­ing DOIs, Figshare doesn’t work with it either. I don’t know why Figshare out their DOIs in a dif­fer­ent way, because I haven’t spoken to them yet. There’s prob­ably a good reason, so that might mean mak­ing a [fig­share] short­code to handle those links.

At the moment the code is up for dis­cus­sion. Once I’ve under­stood this page and added arxiv and fig­share sup­port then I’ll see about adding it to the WordPress plu­gin repository.

Download the plu­gin as a zip file

Update: Thanks to Stack Overflow I now know how to get data for an ISBN, so an [isbn] short­code will be pos­sible too.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>