-
-
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.
Showing
4 changed files
with
65 additions
and
2 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,40 @@ | ||
import { html, styled, OG_SIZE, FONTS } from 'og-images-generator'; | ||
|
||
/** @type {import('og-images-generator').PathsOptions} (Optional) */ | ||
export const paths = { | ||
// DEFAULTS: | ||
base: './dist', | ||
out: './dist/og', | ||
json: './dist/og/index.json', | ||
}; | ||
|
||
const myInlineStyle1 = styled.div` | ||
display: flex; | ||
`; | ||
|
||
const nestedTemplate1 = html`<span>My Website</span>`; | ||
|
||
async function iAmABlocker() { | ||
const stuff = await new Promise((resolve) => | ||
setTimeout(() => resolve('ok then'), 10), | ||
); | ||
|
||
return stuff; | ||
} | ||
|
||
/** @type {import('og-images-generator').Template} */ | ||
export const template = async ({ page }) => | ||
html` <!-- Contrived example --> | ||
<div style=${myInlineStyle1}> | ||
${page.meta?.tags?.['og:title'] ?? 'Untitled'} <br /> | ||
${page.meta?.tags?.['og:description'] ?? 'No description'} | ||
<!-- --> | ||
${nestedTemplate1} | ||
<em>Nice</em> | ||
<strong>Weather, ${await iAmABlocker()}</strong> | ||
</div>`; | ||
|
||
/** @type {import('og-images-generator').RenderOptions} */ | ||
export const renderOptions = { | ||
satori: { fonts: [await FONTS.sourceSans()], ...OG_SIZE }, | ||
}; |
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