search engine optimization III

dev
gravel 7 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 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 string String in the form `token+pubkey[:4]`.

@ -8,26 +8,48 @@
$json_ld_data = array(
'@context' => 'https://schema.org/',
'summary' => 'Active Session Communities',
'@type' => 'Collection',
'totalItems' => count($rooms),
'items' => array_map(function(CommunityRoom $room) {
'@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' => 'Group',
'@type' => 'EntryPoint',
'@id' => $room->get_join_url(),
'additionalType' => 'VirtualLocation',
'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' => $SITE_CANONICAL_URL . '/' . room_icon($room, '64x64')
'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)
);
}, $rooms),
)
?>
<script type="application/ld+json">
<?=preg_replace("\\/", "/", json_encode($json_ld_data))?>
<?=json_encode($json_ld_data)?>
</script>

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

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

@ -77,7 +77,10 @@
$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-pubkey="<?=$pubkey?>"
data-hostname="<?=$hostname?>"
@ -112,18 +115,18 @@
<?php endif; endforeach; ?>
<!--/noindex--></span>
</td>
<td
<!--noindex--><td
class="td_description noindex robots-noindex robots-nocontent"
title="Description for '<?=$name?>':
<?=$desc?>"
itemprop="description"
><!--noindex--><?=$desc?><!--/noindex--></td>
><?=$desc?></td><!--/noindex-->
<td
class="td_users"
title="'<?=$name?>' has had <?=$users?> active users in the last <?=$users_cutoff?>."
><?=$users?></td>
<td class="td_preview" itemprop="url">
<td class="td_preview">
<a
href="<?=$preview_link?>"
title="Click here to preview '<?=$name?>'"

@ -121,7 +121,7 @@
<?=count_rooms($servers)?> unique Session Communities
on <?=count($servers)?> servers have been found.
<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 id="last_checked">
Last checked <span id="last_checked_value">

Loading…
Cancel
Save