-
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
1 parent
5fbc993
commit 215f033
Showing
4 changed files
with
468 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { APIRoute, APIContext } from 'astro' | ||
import { getCollection } from 'astro:content' | ||
// import { readFileSync } from 'fs' | ||
// import satori from 'satori' | ||
// import { html } from 'satori-html' | ||
|
||
const entries = await getCollection('blog') | ||
const pages = await getCollection('page') | ||
const articles = [...entries, ...pages] | ||
|
||
export const GET: APIRoute = async ({ params }: APIContext) => { | ||
const res = new Response('OG Image Not found', { status: 404 }) | ||
const { type, slug } = params | ||
if (type === 'article') { | ||
const article = articles.find((a) => `${a.collection}/${a.slug}` === slug) | ||
if (article) { | ||
// const isArticle = article.collection === "blog" | ||
// const img = | ||
} | ||
} | ||
|
||
return res | ||
} | ||
|
||
export const getStaticPaths = async () => { | ||
const ogs = articles.map((a) => ({ | ||
params: { type: 'article', slug: `${a.collection}/${a.slug}` }, | ||
})) | ||
|
||
return ogs | ||
} |
Oops, something went wrong.