mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 11:41:17 +02:00
feat: add automatic website screenshot generation for Open Graph preview images
This commit is contained in:
parent
30febfef22
commit
a073ea47bd
6 changed files with 19 additions and 18 deletions
|
@ -16,7 +16,7 @@ const currentUI = ui[currentLang as keyof typeof ui]
|
|||
|
||||
const { title, subtitle, description, author, url, favicon, i18nTitle } = themeConfig.site
|
||||
const { mode, light: { background: lightMode }, dark: { background: darkMode } } = themeConfig.color
|
||||
const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '' } = themeConfig.seo ?? {}
|
||||
const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '', apiflashKey = '' } = themeConfig.seo ?? {}
|
||||
const { google = '', bing = '', yandex = '', baidu = '' } = verification
|
||||
const { commentURL = '', imageHostURL = '', customGoogleAnalyticsJS = '', customUmamiAnalyticsJS = '' } = themeConfig.preload
|
||||
|
||||
|
@ -26,7 +26,11 @@ const headSubtitle = i18nTitle ? currentUI.subtitle : subtitle
|
|||
const pageTitle = postTitle ? `${postTitle} | ${headTitle}` : `${headTitle} - ${headSubtitle}`
|
||||
const pageDescription = postDescription || description
|
||||
// TODO: Change openGraph image fallback url
|
||||
const pageImage = postSlug ? `${url}/opengraph/${postSlug}.png` : 'https://placehold.co/1200x630'
|
||||
const pageImage = postSlug
|
||||
? `${url}/opengraph/${postSlug}.png`
|
||||
: apiflashKey
|
||||
? `https://api.apiflash.com/v1/urltoimage?access_key=${apiflashKey}&url=${url}&format=png&width=1500&height=788&ttl=86400&wait_until=network_idle&no_tracking=true`
|
||||
: 'https://api.apiflash.com/v1/urltoimage?access_key=02a837b6188f4ba0a7fd9fbeff03a83e&url=https://retypeset.radishzz.cc&format=png&width=1500&height=788&ttl=86400&wait_until=network_idle&no_tracking=true'
|
||||
---
|
||||
<head>
|
||||
<!-- Basic info -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue