search engine optimization III

dev
gravel 8 months ago
parent e746df1b8d
commit a7d385be43
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -364,6 +364,14 @@
return "$base_url/room/$token/file/$image_id"; return "$base_url/room/$token/file/$image_id";
} }
/**
* Return the URL used to display details about this room-
*/
function get_details_url(): string {
$room_id = $this->get_room_identifier();
return "/#$room_id";
}
/** /**
* Return a globally unique room identifier. * Return a globally unique room identifier.
* @return string String in the form `token+pubkey[:4]`. * @return string String in the form `token+pubkey[:4]`.

@ -8,26 +8,48 @@
$json_ld_data = array( $json_ld_data = array(
'@context' => 'https://schema.org/', '@context' => 'https://schema.org/',
'summary' => 'Active Session Communities', '@id' => $SITE_CANONICAL_URL,
'@type' => 'Collection', 'url' => $SITE_CANONICAL_URL,
'totalItems' => count($rooms), 'description' => 'Up-to-date list of public groups in Session Messenger.',
'items' => array_map(function(CommunityRoom $room) { '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( $values = array(
'@type' => 'Group', '@type' => 'EntryPoint',
'@id' => $room->get_join_url(),
'additionalType' => 'VirtualLocation',
'name' => $room->name, 'name' => $room->name,
'summary' => $room->description, 'description' => $room->description,
'startTime' => $room->created ? date('Y-m-d\TH:i:s', intval($room->created)) : null, 'url' => $SITE_CANONICAL_URL . $room->get_details_url(),
'url' => $room->get_preview_url(), 'image' => $SITE_CANONICAL_URL . '/' . room_icon($room, '64x64'),
'icon' => $SITE_CANONICAL_URL . '/' . room_icon($room, '64x64') 'isPartOf' => array('@id' => $SITE_CANONICAL_URL),
); );
return array_filter($values, function ($value) { return array_filter($values, function ($value) {
return $value != null; return $value != null;
}); });
}, $rooms) }, $rooms),
); )
?> ?>
<script type="application/ld+json"> <script type="application/ld+json">
<?=preg_replace("\\/", "/", json_encode($json_ld_data))?> <?=json_encode($json_ld_data)?>
</script> </script>

@ -1,15 +1,14 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/svg+xml" href="favicon.svg" sizes="any"> <link rel="icon" type="image/svg+xml" href="favicon.svg" sizes="any">
<meta name="keywords" content="Session, Community, Anonymous, Chat">
<meta <meta
http-equiv="Content-Security-Policy" http-equiv="Content-Security-Policy"
content=" content="<?php
script-src 'self'; img-src 'self' data:; ?>script-src 'self'; img-src 'self' data:; <?php
connect-src 'self'; font-src 'none'; ?>connect-src 'self'; font-src 'none'; <?php
object-src 'none'; media-src 'none'; ?>object-src 'none'; media-src 'none'; <?php
form-action 'none'; base-uri 'self'; ?>form-action 'none'; base-uri 'self'; <?php
" ?>"
> >
<link rel="apple-touch-icon" href="./apple-touch-icon.png"> <link rel="apple-touch-icon" href="./apple-touch-icon.png">
<meta name="robots" content="index, follow"> <meta name="robots" content="index, follow">

@ -122,13 +122,11 @@
class="details-modal-pane-button class="details-modal-pane-button
themed-button" themed-button"
data-pane="0" data-pane="0"
class="themed-button"
>Show description</button> >Show description</button>
<button <button
class="details-modal-pane-button class="details-modal-pane-button
themed-button" themed-button"
data-pane="1" data-pane="1"
class="themed-button"
>Show QR Code</button> >Show QR Code</button>
</div> </div>
</div> </div>

@ -77,7 +77,10 @@
$tags_json = json_encode($room->get_room_tags()); $tags_json = json_encode($room->get_room_tags());
?> ?>
<tr class="room-row" itemscope itemtype="https://schema.org/EntryPoint" <tr class="room-row"
itemscope
itemtype="https://schema.org/EntryPoint"
itemid="<?=$join_link?>"
data-identifier="<?=$id?>" data-identifier="<?=$id?>"
data-pubkey="<?=$pubkey?>" data-pubkey="<?=$pubkey?>"
data-hostname="<?=$hostname?>" data-hostname="<?=$hostname?>"
@ -112,18 +115,18 @@
<?php endif; endforeach; ?> <?php endif; endforeach; ?>
<!--/noindex--></span> <!--/noindex--></span>
</td> </td>
<td <!--noindex--><td
class="td_description noindex robots-noindex robots-nocontent" class="td_description noindex robots-noindex robots-nocontent"
title="Description for '<?=$name?>': title="Description for '<?=$name?>':
<?=$desc?>" <?=$desc?>"
itemprop="description" itemprop="description"
><!--noindex--><?=$desc?><!--/noindex--></td> ><?=$desc?></td><!--/noindex-->
<td <td
class="td_users" class="td_users"
title="'<?=$name?>' has had <?=$users?> active users in the last <?=$users_cutoff?>." title="'<?=$name?>' has had <?=$users?> active users in the last <?=$users_cutoff?>."
><?=$users?></td> ><?=$users?></td>
<td class="td_preview" itemprop="url"> <td class="td_preview">
<a <a
href="<?=$preview_link?>" href="<?=$preview_link?>"
title="Click here to preview '<?=$name?>'" title="Click here to preview '<?=$name?>'"

@ -121,7 +121,7 @@
<?=count_rooms($servers)?> unique Session Communities <?=count_rooms($servers)?> unique Session Communities
on <?=count($servers)?> servers have been found. on <?=count($servers)?> servers have been found.
<span id="servers_hidden">(None hidden as JS is off)</span> <span id="servers_hidden">(None hidden as JS is off)</span>
<sup><a href="<?=$REPOSITORY_CANONICAL_URL?>/#policy" target="_blank">why?</a> <sup><a href="<?=$REPOSITORY_CANONICAL_URL?>/#policy" target="_blank">why?</a></sup>
</p> </p>
<p id="last_checked"> <p id="last_checked">
Last checked <span id="last_checked_value"> Last checked <span id="last_checked_value">

Loading…
Cancel
Save