Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/encoded/static/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,8 @@ class App extends React.Component {
const hasSpecialHashTag = hrefUrl.hash?.length > 2 && hrefUrl.hash?.startsWith('#!');
const isHomePage = context['@type']?.[0] === 'Portal' && !hasSpecialHashTag;

const hostWithScheme = `${hrefUrl.protocol}//${hrefUrl.host}`;

/* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions */
return (
<html lang="en" ref={this.props.domReader ? (node) => this.props.domReader(node) : null}>
Expand All @@ -1251,10 +1253,9 @@ class App extends React.Component {
{newsHead(this.props, `${hrefUrl.protocol}//${hrefUrl.host}`)}
{this.state.context && this.state.context['@type'] && this.state.context['@type'].some((type) => ['experiment', 'functionalcharacterizationexperiment', 'annotation'].includes(type.toLowerCase())) ?
<script
data-prop-name="context"
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: `\n\n${jsonScriptEscape(JSON.stringify(jsonldFormatter(this.state.context, hrefUrl.host)))}\n\n`,
__html: `\n\n${jsonScriptEscape(JSON.stringify(jsonldFormatter(this.state.context, hostWithScheme)))}\n\n`,
}}
/>
: null
Expand All @@ -1263,7 +1264,7 @@ class App extends React.Component {
<body onClick={this.handleClick} onSubmit={this.handleSubmit} className={isHomePage ? 'body-portal' : null}>
<script
data-prop-name="context"
type="application/json"
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: `\n\n${jsonScriptEscape(JSON.stringify((this.state.context)))}\n\n`,
}}
Expand Down
8 changes: 4 additions & 4 deletions src/encoded/static/libs/jsonld.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const _mapContextToDistribution = (context, measurementTechnique) => {
contentUrl: `${baseUrl}${context['@id']}`,
sameAs: `${baseUrl}${context['@id']}`,
url: `${baseUrl}${context['@id']}`,
identifier: context.uuid,
identifier: context['@id'],
encodingFormat: 'text',
};

Expand All @@ -58,7 +58,7 @@ const _mapSourceToSourceOrganization = (source) => {
sameAs: source.url,
description: source.description,
url: `${baseUrl}${source['@id']}`,
identifier: source.uuid,
identifier: source['@id'],
};
};

Expand All @@ -71,7 +71,7 @@ const _mapAwardToCreator = (award) => {

return {
'@type': 'Person',
identifier: award.uuid,
identifier: award['@id'],
name: pi.title,
worksFor: {
'@type': 'EducationalOrganization',
Expand Down Expand Up @@ -103,7 +103,7 @@ const jsonldFormatter = (context, url) => {
name: context.accession, // required by Google data set
isAccessibleForFree: true,
isFamilyFriendly: true,
identifier: context.uuid,
identifier: context['@id'],
version: context.schema_version,
publisher: _addPublisher(context),
distribution: _mapContextToDistribution(context, measurementTechnique),
Expand Down