diff --git a/app/Http/Controllers/Publish/DoiController.php b/app/Http/Controllers/Publish/DoiController.php index 97c0ac4..a24f350 100644 --- a/app/Http/Controllers/Publish/DoiController.php +++ b/app/Http/Controllers/Publish/DoiController.php @@ -217,6 +217,7 @@ class DoiController extends Controller $cache = ($dataset->xmlCache) ? $dataset->xmlCache : new \App\Models\XmlCache(); $xmlModel->setXmlCache($cache); $domNode = $xmlModel->getDomDocument()->getElementsByTagName('Rdr_Dataset')->item(0); + $this->addAlternateLandingPageAttribute($domNode, $dataset->publish_id); $node = $this->xml->importNode($domNode, true); $this->addSpecInformation($node, 'data-type:' . $dataset->type); @@ -261,6 +262,24 @@ class DoiController extends Controller } } + /** + * Add the landingpage attribute to Rdr_Dataset XML output. + * + * @param \DOMNode $document Rdr_Dataset XML serialisation + * @param string $docid Id of the dataset + * @return void + */ + private function addAlternateLandingPageAttribute(\DOMNode $document, $dataid) + { + $base_domain = config('tethys.base_domain'); + $url ='https://' . get_domain($base_domain) . "/dataset/" . $dataid; + + $owner = $document->ownerDocument; + $attr = $owner->createAttribute('landingpage'); + $attr->appendChild($owner->createTextNode($url)); + $document->appendChild($attr); + } + /** * Remove the specified resource from storage. *