Skip to content

Commit

Permalink
Merge branch 'dev' into release-5.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaMunterud committed Dec 2, 2024
2 parents 4fbe51d + 356e288 commit 6cb53b7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
19 changes: 14 additions & 5 deletions providers/EntrystoreProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,21 @@ export const EntrystoreProvider: React.FC<EntrystoreProviderProps> = ({
const resourceUri = entry.getResourceURI();

const title =
getSimplifiedLocalizedValue(metadata, "dcterms:title") ||
getSimplifiedLocalizedValue(metadata, "skos:prefLabel");
getSimplifiedLocalizedValue(metadata, "dcterms:title", resourceUri) ||
getSimplifiedLocalizedValue(metadata, "skos:prefLabel", resourceUri);

const description =
getSimplifiedLocalizedValue(metadata, "skos:definition") ||
getSimplifiedLocalizedValue(metadata, "dcterms:description");
getSimplifiedLocalizedValue(metadata, "skos:definition", resourceUri) ||
getSimplifiedLocalizedValue(
metadata,
"dcterms:description",
resourceUri,
);

const publisherUri = metadata.findFirstValue(null, "dcterms:publisher");
const publisherUri = metadata.findFirstValue(
resourceUri,
"dcterms:publisher",
);

let publisher = "";
if (pageType !== "mqa") {
Expand All @@ -151,6 +158,7 @@ export const EntrystoreProvider: React.FC<EntrystoreProviderProps> = ({
publisher = getSimplifiedLocalizedValue(
publisherEntry.getAllMetadata(),
"foaf:name",
publisherUri,
);
}
} catch (error) {}
Expand All @@ -177,6 +185,7 @@ export const EntrystoreProvider: React.FC<EntrystoreProviderProps> = ({
publisher = getSimplifiedLocalizedValue(
publisherEntry.getAllMetadata(),
"foaf:name",
publisherUri,
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion utilities/entrystoreUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ export const getLocalizedValue = async (
export const getSimplifiedLocalizedValue = (
metadata: Metadata,
property: string,
resourceURI?: string,
) => {
const values = metadata.find(null, property);
const values = metadata.find(resourceURI || null, property);
// Try to find Swedish value first
const svValue = values.find((v: MetadataValue) => v.getLanguage() === "sv");
// Fall back to English if no Swedish
Expand Down

0 comments on commit 6cb53b7

Please sign in to comment.