- link to doi.tethys subdomain in search results

This commit is contained in:
Arno Kaimbacher 2021-06-02 10:17:13 +02:00
parent b6338b0543
commit 8d8fafd3db
3 changed files with 11 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,15 @@ export default class VsResults extends Vue {
return this.data;
};
getDomainWithoutSubdomain () {
const urlParts = new URL(window.location.href).hostname.split('.')
return urlParts
.slice(0)
.slice(-(urlParts.length === 4 ? 3 : 2))
.join('.')
}
truncate(text, limit) {
text = text === undefined ? '' : text;
const content = text.split(' ').slice(0, limit);

View File

@ -40,7 +40,7 @@
</p>
<h4>
<a target="_self" v-bind:href="'https://doi.'+ app_url +'/' + datacite_prefix + '/tethys.' + document.id" class="ng-binding">
<a v-if="document.identifier && document.identifier.length > 0" target="_self" v-bind:href="'https://doi.'+ getDomainWithoutSubdomain() +'/' + document.identifier[0]" class="ng-binding">
{{ document.title_output }}
</a>
</h4>