Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doi-landing-page
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maxime Chaillet
doi-landing-page
Commits
90d0623e
Commit
90d0623e
authored
Sep 20, 2019
by
Maxime Chaillet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work in progress.
parent
ef85b091
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
9 deletions
+42
-9
www/src/doicontroller.js
www/src/doicontroller.js
+5
-9
www/src/googleMetadataObject.js
www/src/googleMetadataObject.js
+37
-0
No files found.
www/src/doicontroller.js
View file @
90d0623e
...
...
@@ -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.
"
);
}
...
...
www/src/googleMetadataObject.js
0 → 100644
View file @
90d0623e
/**
* 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.
"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment