Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/deploy-cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Build OpenNext Worker
run: pnpm exec opennextjs-cloudflare build
run: |
pnpm og:build
pnpm exec opennextjs-cloudflare build

- name: Upload preview version
id: upload
Expand Down
12 changes: 12 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import { ThemeProvider } from "@/components/theme-provider"
import { TooltipProvider } from "@/components/ui/tooltip"
import { Toaster } from "sonner"
import {
OG_IMAGE_SIZE,
SITE_AUTHOR,
SITE_DESCRIPTION,
SITE_KEYWORDS,
SITE_NAME,
SITE_TITLE,
SITE_URL,
docsOgImagePath,
rootJsonLd,
} from "@/lib/seo"
import { cn } from "@/lib/utils"
Expand Down Expand Up @@ -66,11 +68,21 @@ export const metadata: Metadata = {
siteName: SITE_NAME,
title: SITE_TITLE,
description: SITE_DESCRIPTION,
images: [
{
url: docsOgImagePath(),
width: OG_IMAGE_SIZE.width,
height: OG_IMAGE_SIZE.height,
alt: SITE_TITLE,
type: "image/png",
},
],
},
twitter: {
card: "summary_large_image",
title: SITE_TITLE,
description: SITE_DESCRIPTION,
images: [docsOgImagePath()],
},
appleWebApp: {
title: SITE_NAME,
Expand Down
34 changes: 0 additions & 34 deletions app/og/docs/[...slug]/route.tsx

This file was deleted.

106 changes: 0 additions & 106 deletions lib/og-image.tsx

This file was deleted.

16 changes: 16 additions & 0 deletions lib/og-paths.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { join } from "node:path"

export const OG_IMAGE_SIZE = { width: 1200, height: 630 }

/** Catch-alls cannot host `opengraph-image`; pages use static `/og/docs/.../image.png`. */
export function docsOgImageSegments(slug) {
return [...(slug ?? []), "image.png"]
}

export function docsOgImagePath(slug) {
return `/og/docs/${docsOgImageSegments(slug).join("/")}`
}

export function docsOgPublicFile(slug, root = process.cwd()) {
return join(root, "public", ...docsOgImagePath(slug).split("/").filter(Boolean))
}
3 changes: 2 additions & 1 deletion lib/seo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function isComponentPage(slug?: string[]): boolean {

export const OG_IMAGE_SIZE = { width: 1200, height: 630 } as const

/** Catch-alls cannot host `opengraph-image`; pages point at `/og/docs/.../image.png`. */
/** Catch-alls cannot host `opengraph-image`; pages use static `/og/docs/.../image.png`. */
export function docsOgImageSegments(slug?: string[]): string[] {
return [...(slug ?? []), "image.png"]
}
Expand Down Expand Up @@ -85,6 +85,7 @@ export function buildPageMetadata({
width: OG_IMAGE_SIZE.width,
height: OG_IMAGE_SIZE.height,
alt: ogTitle,
type: "image/png",
}

return {
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"packageManager": "pnpm@11.20.0",
"scripts": {
"dev": "next dev",
"build": "pnpm registry:build && next build",
"build": "pnpm registry:build && pnpm og:build && next build",
"start": "next start",
"preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
"cf:deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy",
"preview": "pnpm og:build && opennextjs-cloudflare build && opennextjs-cloudflare preview",
"cf:deploy": "pnpm og:build && opennextjs-cloudflare build && opennextjs-cloudflare deploy",
"og:build": "node scripts/build-og-images.mjs",
"cf:upload": "opennextjs-cloudflare build && opennextjs-cloudflare upload",
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
"lint": "eslint",
Expand Down
Binary file added public/og/docs/components/ascii-fluid/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/ascii-logo/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/dithered-404/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/folio/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/live-orb/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/logo-burst/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/radiant-lines/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/shader-fire/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/components/tangle-footer/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/getting-started/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og/docs/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions scripts/build-og-images.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { buildOgImages } from "./og-lib.mjs"

const files = await buildOgImages()
console.log(`OG images written (${files.length})`)
for (const { path } of files) {
console.log(` ${path}`)
}
Loading
Loading