Skip to content

Commit

Permalink
Merge pull request #1676 from NatLibFi/fix-seo-description-vocab-home
Browse files Browse the repository at this point in the history
Avoid showing SEO/metadata description on vocab home page
  • Loading branch information
osma authored Sep 5, 2024
2 parents ba92b43 + 26d2eb3 commit d1dd525
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions model/Vocabulary.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,23 @@ public function getInfo($lang = null)
foreach ($conceptscheme->properties() as $prop) {
foreach ($conceptscheme->allLiterals($prop, $lang) as $val) {
$prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
$ret[$prop][$val->getValue()] = $val;
if ($prop === 'dc:description') {
$ret[$prop] = [$val->getValue() => $val]; // override description from vocabulary config
} else {
$ret[$prop][$val->getValue()] = $val;
}
}
if (!isset($ret[$prop]) || sizeof($ret[$prop]) == 0) { // not found with language tag
foreach ($conceptscheme->allLiterals($prop, null) as $val) {
$prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
if ($val->getValue() instanceof DateTime) {
$val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
}
$ret[$prop][] = $val;
if ($prop === 'dc:description') {
$ret[$prop] = [$val->getValue() => $val]; // override description from vocabulary config
} else {
$ret[$prop][] = $val;
}
}
}
foreach ($conceptscheme->allResources($prop) as $val) {
Expand Down

0 comments on commit d1dd525

Please sign in to comment.