Skip to content

Commit

Permalink
Wrongly removed use of maybeDoc?.options?.icon
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent committed Nov 18, 2024
1 parent b8e1014 commit e19a3ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/server/lib/sendAppPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import * as path from 'path';
import { difference, trimEnd } from 'lodash';

const translate = (req: express.Request, key: string, args?: any) => req.t(`sendAppPage.${key}`, args)?.toString();
const { escapeExpression } = handlebars.Utils;

export interface ISendAppPageOptions {
path: string; // Ignored if .content is present (set to "" for clarity).
Expand Down Expand Up @@ -273,7 +274,7 @@ function configuredPageTitleSuffix() {
function getDocName(config: GristLoadConfig): string|null {
const maybeDoc = getDocFromConfig(config);

return maybeDoc && handlebars.Utils.escapeExpression(maybeDoc.name);
return maybeDoc && escapeExpression(maybeDoc.name);
}

/**
Expand All @@ -291,18 +292,18 @@ function getPageMetadataHtmlSnippet(req: express.Request, config: GristLoadConfi
metadataElements.push('<meta property="og:type" content="website">');
metadataElements.push('<meta name="twitter:card" content="summary_large_image">');
const description = maybeDoc?.options?.description ?? translate(req, 'og-description');
const escapedDescription = handlebars.Utils.escapeExpression(description);
const escapedDescription = escapeExpression(description);
metadataElements.push(`<meta name="description" content="${escapedDescription}">`);
metadataElements.push(`<meta property="og:description" content="${escapedDescription}">`);
metadataElements.push(`<meta name="twitter:description" content="${escapedDescription}">`);

const image = handlebars.Utils.escapeExpression(commonUrls.openGraphPreviewImage);
const image = escapeExpression(maybeDoc?.options?.icon ?? commonUrls.openGraphPreviewImage);
metadataElements.push(`<meta name="thumbnail" content="${image}">`);
metadataElements.push(`<meta property="og:image" content="${image}">`);
metadataElements.push(`<meta name="twitter:image" content="${image}">`);

const maybeDocTitle = getDocName(config);
const title = handlebars.Utils.escapeExpression(
const title = escapeExpression(
maybeDocTitle ? maybeDocTitle + getPageTitleSuffix(config) : translate(req, 'og-title')
);
// NB: We don't generate the content of the <title> tag here.
Expand Down

0 comments on commit e19a3ae

Please sign in to comment.