-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
吉野敬太郎
authored and
吉野敬太郎
committed
Sep 16, 2024
1 parent
1a2c7a9
commit bc4cd6c
Showing
9 changed files
with
188 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,24 @@ | ||
import type { APIContext, APIRoute } from "astro"; | ||
import { getEntry } from "astro:content"; | ||
import { getOgImage } from "./_OgImage"; | ||
|
||
export const prerender = false; | ||
|
||
export async function GET({ params, redirect }: APIContext) { | ||
const { slug } = params; | ||
if (slug === undefined) { | ||
return new Response(null, { | ||
status: 500, | ||
statusText: "No slug provided", | ||
}); | ||
} | ||
const post = await getEntry("post", slug); | ||
if (post === undefined) { | ||
return new Response(null, { | ||
status: 404, | ||
statusText: "Not found", | ||
}); | ||
} | ||
const body = await getOgImage(post?.data.title ?? "No title"); | ||
return new Response(body); | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{ | ||
"extends": "astro/tsconfigs/strict", | ||
"compilerOptions": { | ||
"types": ["bun-types"] | ||
"types": [ | ||
"bun-types" | ||
], | ||
"jsx": "react-jsx", | ||
"jsxImportSource": "react" | ||
} | ||
} | ||
} |