Skip to content

Commit

Permalink
Merge pull request #2 from alt-research/feat/og-title
Browse files Browse the repository at this point in the history
feat: og title
  • Loading branch information
antonio-altr authored Mar 19, 2024
2 parents 9d9233d + 11c3b0a commit 6bb4731
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions configs/app/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const defaultImageUrl = app.baseUrl + '/static/og_placeholder.png';
const meta = Object.freeze({
promoteBlockscoutInTitle: parseEnvJson<boolean>(getEnvValue('NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE')) ?? true,
og: {
title: getEnvValue('NEXT_PUBLIC_OG_TITLE') || '',
description: getEnvValue('NEXT_PUBLIC_OG_DESCRIPTION') || '',
imageUrl: getExternalAssetFilePath('NEXT_PUBLIC_OG_IMAGE_URL') || defaultImageUrl,
},
Expand Down
1 change: 1 addition & 0 deletions deploy/tools/envs-validator/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ const schema = yup
NEXT_PUBLIC_AD_TEXT_PROVIDER: yup.string<AdTextProviders>().oneOf(SUPPORTED_AD_TEXT_PROVIDERS),
NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE: yup.boolean(),
NEXT_PUBLIC_OG_DESCRIPTION: yup.string(),
NEXT_PUBLIC_OG_TITLE: yup.string().optional(),
NEXT_PUBLIC_OG_IMAGE_URL: yup.string().test(urlTest),
NEXT_PUBLIC_SAFE_TX_SERVICE_URL: yup.string().test(urlTest),
NEXT_PUBLIC_IS_SUAVE_CHAIN: yup.boolean(),
Expand Down
1 change: 1 addition & 0 deletions docs/ENVS.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ 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 meta and OG titles | - | `true` | `true` |
| NEXT_PUBLIC_OG_TITLE | `string` | Custom OG title | - | - | - |
| NEXT_PUBLIC_OG_DESCRIPTION | `string` | Custom OG description | - | - | `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. 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` |

Expand Down
2 changes: 1 addition & 1 deletion lib/metadata/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function generate<R extends Route>(route: R, apiData?: ApiData<R>
title: title,
description,
opengraph: {
title: title,
title: pageOgType !== 'Regular page' ? config.meta.og.title : '',
description: pageOgType !== 'Regular page' ? config.meta.og.description : '',
imageUrl: pageOgType !== 'Regular page' ? config.meta.og.imageUrl : '',
},
Expand Down

0 comments on commit 6bb4731

Please sign in to comment.