Skip to content

Commit 81de3a9

Browse files
authored
Merge pull request #338 from semantic-systems/develop
Update error fixes on citation and reference links.
2 parents c17f18b + f4a497c commit 81de3a9

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

templates/publication-details.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,14 @@ <h3 class="d-inline">{{publication.name}}</h3>
318318
}
319319
};
320320

321-
return fields
322-
.map(f => `${f}:${urlEncode(get(f))}`)
323-
.join("/");
321+
parts = fields.map(f => `${f}:${urlEncode(get(f))}`)
322+
323+
// timestamp calculation, same as in main.py > format_digital_obj_url()
324+
const currentTimestamp = String(Date.now() / 1000);
325+
const ts = btoa(unescape(currentTimestamp)).replace(/=+$/g, "");
326+
parts.push(`ts:${ts}`);
327+
328+
return parts.join("/");
324329
}
325330

326331
// functions to show/hide the loading indicator of a specific list (listId = 'references_list' or 'citations_list')
@@ -375,22 +380,23 @@ <h3 class="d-inline">{{publication.name}}</h3>
375380
if (!a.identifier) // if there is no identifier, we dont create a link
376381
return `<li class="list-group-item border-0">${text}</li>`;
377382

383+
// build the URL to the external publication details page
384+
const href = `/publication-details/${formatDigitalObjUrl(a, ['source-name', 'source-id', 'doi'])}`;
385+
378386
// if articles have no metadata (a.partiallyLoaded is true), we only show the DOI with a note
379387
// this happens if we do not find any metadata for a DOI (see main.py > get_publication_metadata())
380388
// we also do this if we do not have any authors or a name (else it would show as " . ()")
381389
const hasMetadata = a.name || a.author?.length;
382390
if (a.partiallyLoaded || !hasMetadata) {
383391
return `<li class="list-group-item border-0">
384392
<a class="text-secondary"
385-
href="/publication-details/source-name:na/source-id:${urlEncode(a.identifier)}/doi:${urlEncode(a.identifier)}"
393+
href=${href}
386394
<i class="bi bi-link-45deg"></i>&nbsp;${a.identifier} <i>(No metadata found)</i>
387395
</a>
388396
</li>`;
389397
}
390398

391399
// build the URL to the external publication details page
392-
const href = `/publication-details/${formatDigitalObjUrl(a, ['source-name', 'source-id', 'doi'])}`;
393-
394400
return `<li class="list-group-item border-0">
395401
<a class="text-secondary"
396402
href="${href}"

0 commit comments

Comments
 (0)