-
Notifications
You must be signed in to change notification settings - Fork 1.5k
conference page — missing OG images #2057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d1e364b
Add SimpleOpengraphImage
hasparus 1364c75
Add OG images for speakers, resources, schedule, and CoC pages
hasparus 0cc5828
JSDoc doesn't make sense here
hasparus 62cd79a
Add https:// to VERCEL_URL for preview deployments
hasparus e48bf06
Add image width to silence build warnings
hasparus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { SimpleOpengraphImage } from "../components/og-images/simple-opengraph-image" | ||
export { | ||
generateStaticParams, | ||
contentType, | ||
size, | ||
} from "../components/og-images/simple-opengraph-image" | ||
|
||
export default SimpleOpengraphImage.bind(null, { | ||
pageTitle: "Code of Conduct", | ||
}) |
171 changes: 171 additions & 0 deletions
171
src/app/conf/2025/components/og-images/conference-opengraph-image-header.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
import { CalendarIcon } from "@/app/conf/_design-system/pixelarticons/calendar-icon" | ||
import { PinIcon } from "@/app/conf/_design-system/pixelarticons/pin-icon" | ||
|
||
import { GraphQLLogo } from "../graphql-conf-logo-link" | ||
import { colors, fonts, RIGHT_COLUMN_WIDTH_PX } from "./speaker-opengraph-image" | ||
|
||
export const OG_IMAGE_HEADER_HEIGHT = 154 | ||
|
||
export function ConferenceOpengraphImageHeader({ | ||
year, | ||
date, | ||
location, | ||
style, | ||
}: { | ||
year: string | ||
date: string | ||
location: string | ||
style?: React.CSSProperties | ||
}) { | ||
return ( | ||
<header | ||
style={{ | ||
display: "flex", | ||
alignItems: "center", | ||
borderBottom: `2px solid ${colors.neu600}`, | ||
...style, | ||
}} | ||
> | ||
<div | ||
style={{ | ||
display: "flex", | ||
flex: 1, | ||
alignItems: "center", | ||
gap: "1.5rem", | ||
borderRight: `2px solid ${colors.neu600}`, | ||
padding: "2.5rem", | ||
paddingRight: "4rem", | ||
height: OG_IMAGE_HEADER_HEIGHT, | ||
}} | ||
> | ||
<div style={{ display: "flex", alignItems: "center", gap: "1rem" }}> | ||
<div | ||
style={{ | ||
fontFamily: fonts.mono, | ||
display: "flex", | ||
fontWeight: "normal", | ||
textTransform: "uppercase", | ||
lineHeight: "1", | ||
color: colors.neu900, | ||
}} | ||
> | ||
<div | ||
style={{ | ||
display: "flex", | ||
height: "74px", | ||
alignItems: "center", | ||
gap: "1rem", | ||
fontSize: "40px", | ||
lineHeight: "1", | ||
textTransform: "uppercase", | ||
}} | ||
> | ||
<GraphQLLogo | ||
style={{ | ||
height: "3rem", | ||
width: "3rem", | ||
color: colors.priBase, | ||
/* hack: satori aligns this SVG differently than browsers, it will look off center in /workroom, | ||
but centered in the images */ | ||
marginTop: "-6px", | ||
}} | ||
/> | ||
<span>/</span> | ||
<div | ||
style={{ display: "flex", alignItems: "center", gap: "0.5rem" }} | ||
> | ||
GraphQLConf{" "} | ||
<span style={{ color: colors.priBase }}>{year}</span> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div | ||
style={{ | ||
display: "flex", | ||
height: "100%", | ||
flexShrink: 0, | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
width: RIGHT_COLUMN_WIDTH_PX, | ||
}} | ||
> | ||
<div | ||
style={{ | ||
display: "flex", | ||
alignItems: "center", | ||
gap: "1.5rem", | ||
borderBottom: `2px solid ${colors.neu600}`, | ||
paddingLeft: "1.5rem", | ||
paddingRight: "1.5rem", | ||
paddingTop: "26px", | ||
paddingBottom: "26px", | ||
}} | ||
> | ||
<div style={{ display: "flex", alignItems: "center", gap: "0.5rem" }}> | ||
<CalendarIcon | ||
width="24" | ||
height="24" | ||
style={{ | ||
/* hack: different across satori and browsers */ | ||
transform: "translateY(-3px)", | ||
color: colors.priBase, | ||
}} | ||
/> | ||
<span | ||
style={{ | ||
fontFamily: fonts.mono, | ||
display: "flex", | ||
fontSize: "1.25rem", | ||
fontWeight: "normal", | ||
textTransform: "uppercase", | ||
lineHeight: "1.2", | ||
color: colors.neu900, | ||
}} | ||
> | ||
{date}, {year} | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div | ||
style={{ | ||
display: "flex", | ||
alignItems: "center", | ||
gap: "1.5rem", | ||
paddingLeft: "1.5rem", | ||
paddingRight: "1.5rem", | ||
paddingTop: "26px", | ||
paddingBottom: "26px", | ||
}} | ||
> | ||
<div style={{ display: "flex", alignItems: "center", gap: "0.5rem" }}> | ||
<PinIcon | ||
width="24" | ||
height="24" | ||
style={{ | ||
/* hack: different across satori and browsers */ | ||
transform: "translateY(-2px)", | ||
color: colors.priBase, | ||
}} | ||
/> | ||
<span | ||
style={{ | ||
fontFamily: fonts.mono, | ||
fontSize: "1.25rem", | ||
fontWeight: "normal", | ||
textTransform: "uppercase", | ||
lineHeight: "1.2", | ||
color: colors.neu900, | ||
}} | ||
> | ||
{location} | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
) | ||
} |
80 changes: 80 additions & 0 deletions
80
src/app/conf/2025/components/og-images/generic-opengraph-image.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { colors, fonts } from "./speaker-opengraph-image" | ||
import { | ||
ConferenceOpengraphImageHeader, | ||
OG_IMAGE_HEADER_HEIGHT, | ||
} from "./conference-opengraph-image-header" | ||
|
||
import graphqlLogoStripes from "./graphql-logo-stripes.png" | ||
|
||
export interface GenericOpengraphImageProps | ||
extends React.HTMLAttributes<HTMLElement> { | ||
date: string | ||
year: string | ||
location: string | ||
pageTitle: string | ||
} | ||
|
||
export function GenericOpengraphImage({ | ||
date, | ||
location, | ||
year, | ||
pageTitle, | ||
...rest | ||
}: GenericOpengraphImageProps) { | ||
const basePath = | ||
`https://${process.env.VERCEL_URL}` || process.env.__NEXT_PRIVATE_ORIGIN | ||
|
||
const height = 630 | ||
|
||
return ( | ||
<article | ||
style={{ | ||
display: "flex", | ||
height, | ||
width: "1200px", | ||
flexDirection: "column", | ||
overflow: "hidden", | ||
borderWidth: "2px", | ||
borderColor: colors.neu600, | ||
backgroundColor: colors.neu100, | ||
fontFamily: fonts.sans, | ||
}} | ||
{...rest} | ||
> | ||
<ConferenceOpengraphImageHeader | ||
year={year} | ||
date={date} | ||
location={location} | ||
/> | ||
|
||
<div | ||
style={{ | ||
display: "flex", | ||
flex: 1, | ||
flexDirection: "column", | ||
justifyContent: "flex-end", | ||
padding: "2.5rem", | ||
position: "relative", | ||
}} | ||
> | ||
<h1 | ||
style={{ | ||
margin: 0, | ||
fontFamily: fonts.sans, | ||
lineHeight: "1.25", | ||
color: colors.neu900, | ||
fontSize: "96px", | ||
}} | ||
> | ||
{pageTitle} | ||
</h1> | ||
<img | ||
src={`${basePath}${graphqlLogoStripes.src}`} | ||
style={{ position: "absolute", right: 0, bottom: -5 }} | ||
height={height - OG_IMAGE_HEADER_HEIGHT} | ||
width={673} | ||
/> | ||
</div> | ||
</article> | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
src/app/conf/2025/components/og-images/normalize-protocol-relative-url.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function normalizeProtocolRelativeUrl(url: string) { | ||
if (url.startsWith("//")) { | ||
return `https:${url}` | ||
} | ||
return url | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're using
bind
here instead of an arrow or a new function because@types/react
doesn't seem to know we can returnPromise<JSX>
just yet.This should be solved after migrating to React 19, but I'm fine with taking this small stylistic/readability hit just to a void dealing with React versions for now.