From 71c96f9926471c056a82e88c3afc2e2db488f3db Mon Sep 17 00:00:00 2001 From: isstuev Date: Thu, 21 Sep 2023 19:07:52 +0200 Subject: [PATCH] review fix --- configs/app/meta.ts | 6 ++++-- docs/ENVS.md | 8 +++++--- lib/metadata/generate.ts | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/configs/app/meta.ts b/configs/app/meta.ts index d39af14acf..13206d5c37 100644 --- a/configs/app/meta.ts +++ b/configs/app/meta.ts @@ -5,8 +5,10 @@ const defaultImageUrl = app.baseUrl + '/static/og_placeholder.png'; const meta = Object.freeze({ promoteBlockscout: getEnvValue(process.env.NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE) || 'true', - ogDescription: getEnvValue(process.env.NEXT_PUBLIC_OG_DESCRIPTION) || '', - ogImageUrl: getEnvValue(process.env.NEXT_PUBLIC_OG_IMAGE_URL) || defaultImageUrl, + og: { + description: getEnvValue(process.env.NEXT_PUBLIC_OG_DESCRIPTION) || '', + imageUrl: getEnvValue(process.env.NEXT_PUBLIC_OG_IMAGE_URL) || defaultImageUrl, + }, }); export default meta; diff --git a/docs/ENVS.md b/docs/ENVS.md index 699a480002..171cbbcba1 100644 --- a/docs/ENVS.md +++ b/docs/ENVS.md @@ -148,11 +148,13 @@ By default, the app has generic favicon. You can override this behavior by provi ### Meta +Settings for meta tags and OG tags + | Variable | Type| Description | Compulsoriness | Default value | Example value | | --- | --- | --- | --- | --- | --- | -| NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE | `boolean` | Set to `true` to promote Blockscout in page titles | - | `true` | `true` | -| NEXT_PUBLIC_OG_DESCRIPTION | `string` | OG description for the homepage | - | - | `Blockscout is the #1 open-source blockchain explorer available today. 100+ chains and counting rely on Blockscout data availability, APIs, and ecosystem tools to support their networks.` | -| NEXT_PUBLIC_OG_IMAGE_URL | `string` | OG image url for homepage and root pages. Minimum image size is 200 x 20 pixels; maximum supported file size is 8 MB; 1.91:1 aspect ratio; supported formats: image/jpeg, image/gif, image/png | - | `static/og_placeholder.png` | `https://placekitten.com/1200/600` | +| NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE | `boolean` | Set to `true` to promote Blockscout in meta and OG titles | - | `true` | `true` | +| NEXT_PUBLIC_OG_DESCRIPTION | `string` | OG description for for homepage and root pages | - | - | `Blockscout is the #1 open-source blockchain explorer available today. 100+ chains and counting rely on Blockscout data availability, APIs, and ecosystem tools to support their networks.` | +| NEXT_PUBLIC_OG_IMAGE_URL | `string` | OG image url for homepage and root pages. Minimum image size is 200 x 20 pixels (recommended: 1200 x 600); maximum supported file size is 8 MB; 2:1 aspect ratio; supported formats: image/jpeg, image/gif, image/png | - | `static/og_placeholder.png` | `https://placekitten.com/1200/600` |   diff --git a/lib/metadata/generate.ts b/lib/metadata/generate.ts index cfe21bf168..4f8e5cb8c9 100644 --- a/lib/metadata/generate.ts +++ b/lib/metadata/generate.ts @@ -27,8 +27,8 @@ export default function generate(route: R, apiData?: ApiData description, opengraph: { title: title, - description: pageOgType !== 'Regular page' ? config.meta.ogDescription : '', - imageUrl: pageOgType !== 'Regular page' ? config.meta.ogImageUrl : '', + description: pageOgType !== 'Regular page' ? config.meta.og.description : '', + imageUrl: pageOgType !== 'Regular page' ? config.meta.og.imageUrl : '', }, }; }