diff --git a/og-image/api/_lib/template.ts b/og-image/api/_lib/template.ts
index a6b0336c..0be8b70c 100644
--- a/og-image/api/_lib/template.ts
+++ b/og-image/api/_lib/template.ts
@@ -91,6 +91,8 @@ export function getHtml(parsedReq: ParsedRequest) {
creatorName,
creatorUsername,
creatorAvatarUrl,
+ challengeAmount,
+ challengeOutcome,
} = parsedReq
const MAX_QUESTION_CHARS = 100
const truncatedQuestion =
@@ -148,7 +150,12 @@ export function getHtml(parsedReq: ParsedRequest) {
${truncatedQuestion}
-
${probability}
+
${
+ challengeAmount ? challengeAmount : probability
+ }
+
${
+ challengeOutcome ? 'on' + challengeOutcome : ''
+ }
${probability !== '' ? 'chance' : ''}
diff --git a/og-image/api/_lib/types.ts b/og-image/api/_lib/types.ts
index c0126a3b..eb8b412d 100644
--- a/og-image/api/_lib/types.ts
+++ b/og-image/api/_lib/types.ts
@@ -1,21 +1,23 @@
-export type FileType = "png" | "jpeg";
-export type Theme = "light" | "dark";
+export type FileType = 'png' | 'jpeg'
+export type Theme = 'light' | 'dark'
export interface ParsedRequest {
- fileType: FileType;
- text: string;
- theme: Theme;
- md: boolean;
- fontSize: string;
- images: string[];
- widths: string[];
- heights: string[];
+ fileType: FileType
+ text: string
+ theme: Theme
+ md: boolean
+ fontSize: string
+ images: string[]
+ widths: string[]
+ heights: string[]
// Attributes for Manifold card:
- question: string;
- probability: string;
- metadata: string;
- creatorName: string;
- creatorUsername: string;
- creatorAvatarUrl: string;
+ question: string
+ probability: string
+ metadata: string
+ creatorName: string
+ creatorUsername: string
+ creatorAvatarUrl: string
+ challengeAmount: string
+ challengeOutcome: string
}
diff --git a/web/components/SEO.tsx b/web/components/SEO.tsx
index 11e24c99..85eceae4 100644
--- a/web/components/SEO.tsx
+++ b/web/components/SEO.tsx
@@ -10,7 +10,7 @@ export type OgCardProps = {
creatorAvatarUrl?: string
}
-function buildCardUrl(props: OgCardProps) {
+function buildCardUrl(props: OgCardProps, challengeProps?: ChallengeCardProps) {
const probabilityParam =
props.probability === undefined
? ''
@@ -20,6 +20,10 @@ function buildCardUrl(props: OgCardProps) {
? ''
: `&creatorAvatarUrl=${encodeURIComponent(props.creatorAvatarUrl ?? '')}`
+ const challengeUrlParams = challengeProps
+ ? `&challengeAmount=${challengeProps.challengeAmount}&challengeOutcome=${challengeProps.challengeOutcome}`
+ : ''
+
// URL encode each of the props, then add them as query params
return (
`https://manifold-og-image.vercel.app/m.png` +
@@ -28,9 +32,14 @@ function buildCardUrl(props: OgCardProps) {
`&metadata=${encodeURIComponent(props.metadata)}` +
`&creatorName=${encodeURIComponent(props.creatorName)}` +
creatorAvatarUrlParam +
- `&creatorUsername=${encodeURIComponent(props.creatorUsername)}`
+ `&creatorUsername=${encodeURIComponent(props.creatorUsername)}` +
+ challengeUrlParams
)
}
+type ChallengeCardProps = {
+ challengeAmount: string
+ challengeOutcome: string
+}
export function SEO(props: {
title: string
@@ -38,8 +47,10 @@ export function SEO(props: {
url?: string
children?: ReactNode
ogCardProps?: OgCardProps
+ challengeCardProps?: ChallengeCardProps
}) {
- const { title, description, url, children, ogCardProps } = props
+ const { title, description, url, children, ogCardProps, challengeCardProps } =
+ props
return (
@@ -71,13 +82,13 @@ export function SEO(props: {
<>