Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JavaScript script to enable Content-Negotiation call for DataCite metadata in schema.org format
$(document).ready(function() {
var identifier = "https://doi.org/10.5284/1015681"; //for example 10.5284/1015681
if (identifier === undefined) {
return;
}
var doi = new URL(identifier);
var url = "https://data.datacite.org";
url += '/application/vnd.schemaorg.ld+json/' + doi.pathname;
$.ajax({
url: url,
dataType: 'text', // don't convert JSON to Javascript object
success: function(data) {
$('<script>')
.attr('type', 'application/ld+json')
.text(data)
.appendTo('head');
},
error: function (error) {
console.log(error.responseJSON);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.