ใชใใใใฎๅ็ Open Graph ๅ ฅ้
- categories:
- tags:
- topics:
ใใฎใตใคใใไฝใใใจใใใจใใฎใฏใชใใใฎ 2ใ
็ต็ทฏ
ใชใใใใใใญใฐๆธใใใ Twitter ใจใใงๅ ฑๆใใใใใ
่ญ่ ใๅ็ og ใๅฟ ่ฆใ ใญใVercel ใๅฉ็จใใฆๅ็ og ใ็ๆใใๅฐใใใตใผใในใไฝใฃใฆใฟใใจใใใใ
vercel/og ใใฅใผใใชใขใซ
ใชใใใใไปๅบฆใฏๅคใๆ
ๅ ฑใซ่ธใใใใชใใใๆค็ดขใใใจ og-image ใฎไฝฟ็จไพใๆๅใซๅบใฆใใใใฉใGitHub ใซไฝใๆธใใๆธใใฆใใใ
Warning This repo is outdated and only works with Node.js 14. Please use @vercel/og for new projects.
If you have a problem that reproduces using the playground, please create an issue in the satori repo.
For all other issues with @vercel/og, please reach out to Vercel Support.
ใชใใใใๅ ฌๅผใฎๆกๅ ใซ่ผใฃใฆใ ไพ ใ่ฆใฆ้ ๅผตใฃใฆใฟใใใ
ใชใใใใ่ๆฏใใถใคใณใซใฏ haikei ใไฝฟใใใ
ใคใพใฅใ encodeURI
ใชใใใใใใผใใ
่ญ่ ใใฉใใใใใ ใ๏ผใ
ใชใใใใๅ็ og ใ่จญๅฎใใใใ ใใฉใ
GitHub Pages & Next.js ใงๅไบบใตใคใไฝใฃใฆใคใพใฅใใใจใใ
ใชใใใใใฃใฆ่กจ็คบใใฆใปใใใฎใซใ
GitHub Pages
ใชใใใใใซใชใฃใกใใใใ ใใญใ
่ญ่
ใ& ใๅซใพใใฆใใใใฉใURI ใจใณใณใผใใฏใใใฆใใใ ใใญ๏ผใ
ใชใใใใใใใชๆใใซใใใฆใใใ
<meta
property="og:image"
content={`https://example.com/api/og?title=${encodeURI(
title ? title : siteTitle
)}`}
/>
่ญ่
ใใใใใใใฏ encodeURI ใไฝฟ็จใใฆใใใใใ ใใ
encodeURIComponent
่ญ่
ใๆญฃใใใฏ encodeURIComponent ใไฝฟใใใ ใใ
<meta
property="og:image"
- content={`https://example.com/api/og?title=${encodeURI(
+ content={`https://example.com/api/og?title=${encodeComponentURI(
title ? title : siteTitle
)}`}
/>
่ญ่
ใencodeURI ใฏ & ใๅซใใๆฉ่ฝใๆใคๆๅญใใจใณใณใผใใใชใใใ ใๆฉ่ฝใใใใฎใซใจใณใณใผใใใใใๅฐใใใใญใ
ใชใใใใใชใใปใฉใชใใ
ใพใจใ
encodeURIใฏ&ใชใฉใฎๆๅญใใใผใปใณใใจใณใณใผใใใชใใ- ใใใใซ
encodeURIComponentใไฝฟใใ
