Skip to content

Commit

Permalink
Add some <meta name="description" ...> to pages
Browse files Browse the repository at this point in the history
Part of #202
  • Loading branch information
MadLittleMods committed May 5, 2023
1 parent b108845 commit 1cdb8ef
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions server/hydrogen-render/render-page-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function renderPageHtml({
assert(vmRenderContext);
assert(pageOptions);
assert(pageOptions.title);
assert(pageOptions.description);
assert(pageOptions.entryPoint);
assert(pageOptions.cspNonce);

Expand Down Expand Up @@ -47,6 +48,7 @@ function renderPageHtml({
${sanitizeHtml(`<title>${pageOptions.title}</title>`)}
<link rel="icon" href="${faviconMap.ico}" sizes="any">
<link rel="icon" href="${faviconMap.svg}" type="image/svg+xml">
${sanitizeHtml(`<meta name="description" content="${pageOptions.description}">`)}
${styles
.map(
(styleUrl) =>
Expand Down
1 change: 1 addition & 0 deletions server/middleware/timeout-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ async function timeoutMiddleware(req, res, next) {

const pageOptions = {
title: `Server timeout - Matrix Public Archive`,
description: `Unable to respond in time (${requestTimeoutMs / 1000}s)`,
entryPoint: 'client/js/entry-client-timeout.js',
locationHref: urlJoin(basePath, req.originalUrl),
// We don't have a Matrix room so we don't know whether or not to index. Just choose
Expand Down
3 changes: 2 additions & 1 deletion server/routes/client-side-room-alias-hash-redirect-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ assert(basePath);
function clientSideRoomAliasHashRedirectRoute(req, res) {
const pageOptions = {
title: `Page not found - Matrix Public Archive`,
description: `This page does not exist but we may be able to redirect you to the right place.`,
entryPoint: 'client/js/entry-client-room-alias-hash-redirect.js',
locationHref: urlJoin(basePath, req.originalUrl),
// We don't have a Matrix room so we don't know whether or not to index. Just choose
Expand All @@ -30,7 +31,7 @@ function clientSideRoomAliasHashRedirectRoute(req, res) {
404: Page not found.
<span class="js-try-redirect-message" style="display: none">One sec while we try to redirect you to the right place.</span>
</h1>
<p>If there was a #room_alias:server hash in the URL, we tried redirecting you to the right place.</p>
<p>If there was a #room_alias:server hash in the URL, we tried redirecting you to the right place.</p>
<p>
Otherwise, you're simply in a place that does not exist.
You can ${sanitizeHtml(`<a href="${basePath}">go back to the homepage</a>.`)}
Expand Down
1 change: 1 addition & 0 deletions server/routes/room-directory-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ router.get(

const pageOptions = {
title: `Matrix Public Archive`,
description: 'Browse thousands of rooms using Matrix...',
entryPoint: 'client/js/entry-client-room-directory.js',
locationHref: urlJoin(basePath, req.originalUrl),
shouldIndex,
Expand Down
1 change: 1 addition & 0 deletions server/routes/room-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ router.get(

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

0 comments on commit 1cdb8ef

Please sign in to comment.