SEO & JSON-LD

parallel-fetching
gravel 2 years ago
parent 5017933542
commit 74206ae3b6
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -0,0 +1,31 @@
<?php
include "$PROJECT_ROOT/php/utils/room-icons.php";
/**
* @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>

@ -23,6 +23,7 @@
id="details-modal-community-name"
data-hydrate-with="name;preview_link:href"
title="Open preview in new tab"
href="#"
></a></h1>
</div>
<p id="details-modal-description">
@ -52,6 +53,7 @@
data-hydrate-with="hostname;hostname:href"
target="_blank"
rel="noopener noreferrer"
href="#"
></a>
</p>
</div>

@ -49,6 +49,7 @@
<meta property="og:type" content="website">
<meta property="og:locale" content="en_US"/>
<meta name="timestamp" content="<?=$timestamp?>">
<?php include "+components/communities-json-ld.php"; ?>
</head>
<body>
<input type="checkbox" id="toggle-theme-switch">

Loading…
Cancel
Save