You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sessioncommunities.online/sites/+components/communities-json-ld.php

31 lines
991 B
PHTML

2 years ago
<?php
include_once "$PROJECT_ROOT/php/utils/room-icons.php";
2 years ago
/**
* @var \CommunityRoom[] $rooms
*/
$json_ld_data = array(
"@context" => "https://www.w3.org/ns/activitystreams",
"summary" => "Active Session Communities",
"type" => "Collection",
"totalItems" => count($rooms),
"items" => array_map(function(\CommunityRoom $room) {
$values = array(
"type" => "Group",
"name" => $room->name,
"summary" => $room->description,
"startTime" => $room->created ? date('Y-m-d\TH:i:s', intval($room->created)) : null,
"url" => $room->get_preview_url(),
"icon" => room_icon($room, '64x64')
);
return array_filter($values, function ($value) {
return $value != null;
});
}, $rooms)
);
?>
<script type="application/ld+json">
<?=json_encode($json_ld_data)?>
</script>