GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit 90d0623e authored by Maxime Chaillet's avatar Maxime Chaillet

work in progress.

parent ef85b091
......@@ -172,15 +172,11 @@ DOIController.prototype.getDataForGoogleSearch = function (doi) {
//dataType: 'text', // don't convert JSON to Javascript object
success: function (data) {
if (data) {
// Here we add the 'description' field in the recieved object because 'name' and 'description' fields are required by google dataset search.
if (data.name) {
if (!data.description) {
data.description = data.name;
}
_this.view.addDOIMetadataToHead(JSON.stringify(data));
} else {
console.log("[GOOGLE SEARCH INDEXING] - The data required by Google is missing the 'name' field. This is required by Google for indexing.");
}
googleMetadataObject = new GoogleMetadataObject(data);
googleMetadataObject.setDescription();
googleMetadataObject.setLicense();
_this.view.addDOIMetadataToHead(JSON.stringify(googleMetadataObject.getMetadata()));
} else {
console.log("[GOOGLE SEARCH INDEXING] - No metadata recieved from datacite.");
}
......
/**
* This class corresponds to a Google metadata object
* @param {*} data
*/
function GoogleMetadataObject(data) {
this.data = data;
}
/**
* Get metadata
*/
GoogleMetadataObject.prototype.getMetadata = function () {
return this.data;
}
/**
* Set a license
*/
GoogleMetadataObject.prototype.setLicense = function () {
if (!this.data.license) {
this.data.license = "https://creativecommons.org/licenses/by/4.0"
}
}
/**
* Set a description.
*/
GoogleMetadataObject.prototype.setDescription = function () {
if (this.data.name) {
if (!this.data.description) {
this.data.description = this.data.name;
}
} else {
console.log("[GoogleMetadataObject] - The data required by Google is missing the 'name' field. This is required by Google for indexing.");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment