fix(genre.php.liquid): add and word as a separator at the proper point when listing top artists for a genre

This commit is contained in:
Cory Dransfeldt 2025-05-06 14:09:31 -07:00
parent 53e160ebc1
commit afa7144142
No known key found for this signature in database
3 changed files with 198 additions and 263 deletions

View file

@ -15,7 +15,12 @@ schema: genre
foreach ($artists as $artist) {
$artistLinks[] = '<a href="' . htmlspecialchars($artist["url"]) . '">' . htmlspecialchars($artist["name"]) . '</a>';
}
echo implode(', ', $artistLinks);
if (count($artistLinks) > 1) {
$last = array_pop($artistLinks);
echo implode(', ', $artistLinks) . ' and ' . $last;
} else {
echo implode('', $artistLinks);
}
?>. I've listened to&puncsp;<mark><?= $genre["total_plays"] . ' ' . pluralize($genre["total_plays"], "play") ?></mark>&puncsp;tracks from this genre.</p>
<hr />
<?php endif; ?>