Add string to ds-item-page-uri-field in DSpace 7

166 views
Skip to first unread message

euler

unread,
Jan 21, 2024, 5:42:50 PM1/21/24
to DSpace Technical Support
Dear All,

I would like to ask how can I add a string to a ds-item-page-uri-field? I noticed that this will only work if the field is a URL. I'm trying to display the DOI of the item in the simple item page but all of our existing DOIs doesn't have the "https://doi.org/" which is what we really want because we will be using it later as value for altmetrics, dimensions or plumx.
Below is my entry for the DOI field in the untyped-item.component.html:
<ds-item-page-uri-field [item]="object"
[fields]="['dc.identifier.doi']"
[label]="'item.preview.dc.identifier.doi'">
</ds-item-page-uri-field>

However, the resulting link is not a valid DOI because it will just add the DOI value to the URL of the repository.
DOI.PNG
So my question is how can I add the string "https://doi.org/" before the DOI value so that the resulting link is a valid URL?

Thanks in advance!
euler

Michael Plate

unread,
Jan 22, 2024, 4:28:26 AM1/22/24
to dspac...@googlegroups.com

Hi euler,

Am 21.01.24 um 23:42 schrieb euler:
Dear All,

I would like to ask how can I add a string to a ds-item-page-uri-field?

You have multiple opportunities:

doing it directly in the template, but this is sort of limited; I don't have an example that directly fits your problem, but you can do it like this

    <ng-container *ngIf="object.metadata['dc.contributor.editor']">
      <h2>{{'relationships.isEditorOf' | translate}}</h2>
      <div style="word-break: break-word;display: inline-block;" *ngFor="let authors of object.metadata['dc.contributor.editor']| keyvalue">
        <a href="/browse/author?value={{authors.value.value}}" style="border:1px solid #f0f0f0;border-radius:4px;background-color:#f0f0f0;margin:2px;display: inline-block;">{{ authors.value.value}}</a>
      </div>
    </ng-container>

This was as a test before writing a component, it checks for the existence of 'dc.contributor.editor' in the metadata (object.metadata) and renders this in a loop as an ULR…this is just an idea of how to achieve that.

The better possibility is writing an own component  (https://wiki.lyrasis.org/display/DSPACE/DSpace+7+-+Angular+UI+Development) in a theme or changing the base theme; you will find ./src/app/item-page/simple/field-components/specific-field/uri/item-page-uri-field.component.[ts|html] just to see it uses another component 'ds-metadata-uri-values' - but in the *ts you can extend the metadatavalue with 'http…', maybe.


I noticed that this will only work if the field is a URL. I'm trying to display the DOI of the item in the simple item page but all of our existing DOIs doesn't have the "https://doi.org/" which is what we really want because we will be using it later as value for altmetrics, dimensions or plumx.

We save all our PIs with its namespace, doi:, urn:nbn: e.g., so you thankfully remind me to look at it :) .

Michael

euler

unread,
Jan 23, 2024, 4:47:37 AM1/23/24
to DSpace Technical Support
Hi Michael,

Thank you for this, it worked! My issue is that it is not following the styling of the other metadata even though I added the classes I found in the other metadata such as the URI field. I resolved it by manually adding an inline CSS rule and I don't know if this is the right way to do this.
Anyways, thanks again and you answered my question regarding adding a string to a specific metadata value.

Best regards,
euler
Reply all
Reply to author
Forward
0 new messages