-
Notifications
You must be signed in to change notification settings - Fork 141
docs: fix dynamic ogs, lint scripts and cleanup #527
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
Open
adriandlam
wants to merge
20
commits into
main
Choose a base branch
from
fix/docs-stuff
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
cd5fc16
docs: add dynamic og
adriandlam 3e4bfde
docs: standardize codeblock language and line numbers
adriandlam ad13a2e
docs: update getting started intro comp
adriandlam ac4192c
refactor: rename intro comp in dos
adriandlam d934ce0
docs: update intro
adriandlam 1fdc0d3
fix import docs
adriandlam fbd1b41
docs: fix getting started discrepancies
adriandlam 19ffdba
docs: fix identation
adriandlam f8dc838
docs: standardize accordion styles
adriandlam 16b95a1
docs: fix nextjs spacing
adriandlam 4121203
ci: add lint quote and example scripts
adriandlam b1b1693
ci: update linting scripts
adriandlam ed4ee9f
fix styling
adriandlam cb6409a
docs: fix quote lint
adriandlam 97336d2
ci: update lint script for docs
adriandlam 385e0d1
remove console log
adriandlam 4f6a665
docs: fix set up verb accordion on getting started
adriandlam d78f187
fix
adriandlam 5984f0d
Update docs/app/og/[...slug]/route.tsx
adriandlam 8926241
rename test
adriandlam 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
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,90 @@ | ||
| import { readFile } from 'node:fs/promises'; | ||
| import { join } from 'node:path'; | ||
| import { ImageResponse } from 'next/og'; | ||
| import type { NextRequest } from 'next/server'; | ||
| import { getPageImage, source } from '@/lib/geistdocs/source'; | ||
|
|
||
| export const GET = async ( | ||
| _request: NextRequest, | ||
| { params }: RouteContext<'/og/[...slug]'> | ||
| ) => { | ||
| const { slug } = await params; | ||
| const page = source.getPage(slug.slice(0, -1)); | ||
|
|
||
| if (!page) { | ||
| return new Response('Not found', { status: 404 }); | ||
| } | ||
|
|
||
| const { title, description } = page.data; | ||
|
|
||
| const regularFont = await readFile( | ||
| join(process.cwd(), 'app/og/[...slug]/geist-sans-regular.ttf') | ||
| ); | ||
|
|
||
| const semiboldFont = await readFile( | ||
| join(process.cwd(), 'app/og/[...slug]/geist-sans-semibold.ttf') | ||
| ); | ||
|
|
||
| const backgroundImage = await readFile( | ||
| join(process.cwd(), 'app/og/[...slug]/background.png') | ||
| ); | ||
|
|
||
| const backgroundImageData = backgroundImage.buffer.slice( | ||
| backgroundImage.byteOffset, | ||
| backgroundImage.byteOffset + backgroundImage.byteLength | ||
| ); | ||
|
|
||
| return new ImageResponse( | ||
| <div style={{ fontFamily: 'Geist' }} tw="flex h-full w-full"> | ||
| {/** biome-ignore lint/performance/noImgElement: "Required for Satori" */} | ||
| <img | ||
| alt="Vercel OpenGraph Background" | ||
| height={628} | ||
| src={backgroundImageData as never} | ||
| width={1200} | ||
| /> | ||
| <div tw="flex flex-col absolute h-full w-[750px] left-[82px] top-[164px] pb-[86px] pt-[120px] max-w-2xl"> | ||
| <div | ||
| style={{ | ||
| textWrap: 'balance', | ||
| }} | ||
| tw="text-7xl font-medium text-white flex leading-[1.1] mb-4 text-[#ededed] tracking-[-0.04em]" | ||
| > | ||
| {title} | ||
| </div> | ||
| <div | ||
| style={{ | ||
| color: '#8B8B8B', | ||
| lineHeight: '38px', | ||
| textWrap: 'balance', | ||
| }} | ||
| tw="text-[28px] text-[#A0A0A0]" | ||
| > | ||
| {description} | ||
| </div> | ||
| </div> | ||
| </div>, | ||
| { | ||
| width: 1200, | ||
| height: 628, | ||
| fonts: [ | ||
| { | ||
| name: 'Geist', | ||
| data: regularFont, | ||
| weight: 400, | ||
| }, | ||
| { | ||
| name: 'Geist', | ||
| data: semiboldFont, | ||
| weight: 500, | ||
| }, | ||
| ], | ||
| } | ||
| ); | ||
| }; | ||
|
|
||
| export const generateStaticParams = () => | ||
| source.getPages().map((page) => ({ | ||
| lang: page.locale, | ||
| slug: getPageImage(page).segments, | ||
| })); | ||
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,9 @@ | ||
| export function GettingStartedIntro({ framework }: { framework: string }) { | ||
| return ( | ||
| <p> | ||
| This guide will walk through setting up your first workflow in a{' '} | ||
| {framework} app. Along the way, you'll learn more about the concepts that | ||
| are fundamental to using the development kit in your own projects. | ||
| </p> | ||
| ); | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.