Skip to content

Commit 1cdb8ef

Browse files
committed
Add some <meta name="description" ...> to pages
Part of #202
1 parent b108845 commit 1cdb8ef

File tree

5 files changed

+7
-1
lines changed

5 files changed

+7
-1
lines changed

server/hydrogen-render/render-page-html.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function renderPageHtml({
1717
assert(vmRenderContext);
1818
assert(pageOptions);
1919
assert(pageOptions.title);
20+
assert(pageOptions.description);
2021
assert(pageOptions.entryPoint);
2122
assert(pageOptions.cspNonce);
2223

@@ -47,6 +48,7 @@ function renderPageHtml({
4748
${sanitizeHtml(`<title>${pageOptions.title}</title>`)}
4849
<link rel="icon" href="${faviconMap.ico}" sizes="any">
4950
<link rel="icon" href="${faviconMap.svg}" type="image/svg+xml">
51+
${sanitizeHtml(`<meta name="description" content="${pageOptions.description}">`)}
5052
${styles
5153
.map(
5254
(styleUrl) =>

server/middleware/timeout-middleware.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ async function timeoutMiddleware(req, res, next) {
8383

8484
const pageOptions = {
8585
title: `Server timeout - Matrix Public Archive`,
86+
description: `Unable to respond in time (${requestTimeoutMs / 1000}s)`,
8687
entryPoint: 'client/js/entry-client-timeout.js',
8788
locationHref: urlJoin(basePath, req.originalUrl),
8889
// We don't have a Matrix room so we don't know whether or not to index. Just choose

server/routes/client-side-room-alias-hash-redirect-route.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ assert(basePath);
1515
function clientSideRoomAliasHashRedirectRoute(req, res) {
1616
const pageOptions = {
1717
title: `Page not found - Matrix Public Archive`,
18+
description: `This page does not exist but we may be able to redirect you to the right place.`,
1819
entryPoint: 'client/js/entry-client-room-alias-hash-redirect.js',
1920
locationHref: urlJoin(basePath, req.originalUrl),
2021
// We don't have a Matrix room so we don't know whether or not to index. Just choose
@@ -30,7 +31,7 @@ function clientSideRoomAliasHashRedirectRoute(req, res) {
3031
404: Page not found.
3132
<span class="js-try-redirect-message" style="display: none">One sec while we try to redirect you to the right place.</span>
3233
</h1>
33-
<p>If there was a #room_alias:server hash in the URL, we tried redirecting you to the right place.</p>
34+
<p>If there was a #room_alias:server hash in the URL, we tried redirecting you to the right place.</p>
3435
<p>
3536
Otherwise, you're simply in a place that does not exist.
3637
You can ${sanitizeHtml(`<a href="${basePath}">go back to the homepage</a>.`)}

server/routes/room-directory-routes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ router.get(
7575

7676
const pageOptions = {
7777
title: `Matrix Public Archive`,
78+
description: 'Browse thousands of rooms using Matrix...',
7879
entryPoint: 'client/js/entry-client-room-directory.js',
7980
locationHref: urlJoin(basePath, req.originalUrl),
8081
shouldIndex,

server/routes/room-routes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ router.get(
898898

899899
const pageOptions = {
900900
title: `${roomData.name} - Matrix Public Archive`,
901+
description: `View the history of ${roomData.name} in the Matrix Public Archive`,
901902
entryPoint: 'client/js/entry-client-hydrogen.js',
902903
locationHref: urlJoin(basePath, req.originalUrl),
903904
shouldIndex,

0 commit comments

Comments
 (0)