Overview
This is a personal note on how to retrieve the URL of site pages where items are published in the Omeka S OaiPmh Repository module.
Background
The following article introduces how to create custom vocabularies using OaiPmhRepository.
Please refer to it as well.
Retrieving the URL of Site Pages Where Items Are Published
Before Fix
In a certain customization case, the site page URL was retrieved as follows. This does not work properly when something other than dcterms:identifier is configured in the Clean URL module. Additionally, hardcoded paths like /s/db/record/ can be seen.
if ( $item->value( "dcterms:identifier" ) ) {
$this->appendNewElement($oai, 'curation:relation', self::prefix."/s/db/record/".(string)$item->value("dcterms:identifier")->value());
}
After Fix
It was possible to write it more simply as follows. This also handles cases where the item is published on multiple sites.
$sites = $item->sites();
foreach ($sites as $key => $site) {
$siteSlug = $site->slug();
$this->appendNewElement($oai, 'curation:relation', $item->siteUrl($siteSlug, true));
}
Summary
I hope this serves as a useful reference for building an OAI-PMH repository with Omeka S.




Comments
…