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.
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
require_once '+getenv.php';
|
|
require_once 'php/assets/room-icons.php';
|
|
|
|
/**
|
|
* @var CommunityRoom[] $rooms
|
|
*/
|
|
|
|
$json_ld_data = array(
|
|
'@context' => 'https://schema.org/',
|
|
'@id' => $SITE_CANONICAL_URL,
|
|
'url' => $SITE_CANONICAL_URL,
|
|
'description' => 'Up-to-date list of public groups in Session Messenger.',
|
|
'name' => 'Session Communities List',
|
|
'@type' => 'WebSite',
|
|
'additionalType' => 'Collection',
|
|
'collectionSize' => count($rooms),
|
|
'dateModified' => date('c',filemtime($ROOMS_FILE)),
|
|
'image' => "$SITE_CANONICAL_URL/favicon.svg",
|
|
'isAccessibleForFree' => true,
|
|
'maintainer' => array(
|
|
'name' => 'gravel',
|
|
'sameAs' => "https://codeberg.org/gravel",
|
|
),
|
|
'potentialAction' => array(
|
|
'@type' => 'SearchAction',
|
|
'target' => "$SITE_CANONICAL_URL/#q={search_term_string}",
|
|
'query-input' => 'required name=search_term_string'
|
|
)
|
|
);
|
|
|
|
$json_ld_data_rooms = array(
|
|
'@context' => 'https://schema.org/',
|
|
'@graph' => array_map(function(CommunityRoom $room) {
|
|
$values = array(
|
|
'@type' => 'EntryPoint',
|
|
'@id' => $room->get_join_url(),
|
|
'additionalType' => 'VirtualLocation',
|
|
'name' => $room->name,
|
|
'description' => $room->description,
|
|
'url' => $SITE_CANONICAL_URL . $room->get_details_url(),
|
|
'image' => $SITE_CANONICAL_URL . '/' . room_icon($room, '64x64'),
|
|
'isPartOf' => array('@id' => $SITE_CANONICAL_URL),
|
|
);
|
|
return array_filter($values, function ($value) {
|
|
return $value != null;
|
|
});
|
|
}, $rooms),
|
|
)
|
|
?>
|
|
|
|
<script type="application/ld+json">
|
|
<?=json_encode($json_ld_data)?>
|
|
|
|
</script>
|