fix: social images

This commit is contained in:
Travis Fischer
2022-04-06 09:37:01 -04:00
parent 0b7d6187c0
commit ee1333c6c8
6 changed files with 18 additions and 17 deletions

View File

@@ -3,7 +3,7 @@ import { getAllPagesInSpace } from 'notion-utils'
import * as types from './types'
import { includeNotionIdInUrls } from './config'
import { notion } from './notion'
import { notion } from './notion-api'
import { getCanonicalPageId } from './get-canonical-page-id'
const uuid = !!includeNotionIdInUrls

5
lib/notion-api.ts Normal file
View File

@@ -0,0 +1,5 @@
import { NotionAPI } from 'notion-client'
export const notion = new NotionAPI({
apiBaseUrl: process.env.NOTION_API_BASE_URL
})

View File

@@ -1,6 +1,6 @@
import { NotionAPI } from 'notion-client'
import { ExtendedRecordMap, SearchParams, SearchResults } from 'notion-types'
import { notion } from './notion-api'
import { getPreviewImageMap } from './preview-images'
import { getTweetAstMap } from './tweet-embeds'
import {
@@ -8,10 +8,6 @@ import {
isTweetEmbedSupportEnabled
} from './config'
export const notion = new NotionAPI({
apiBaseUrl: process.env.NOTION_API_BASE_URL
})
export async function getPage(pageId: string): Promise<ExtendedRecordMap> {
const recordMap = await notion.getPage(pageId)

View File

@@ -49,9 +49,9 @@
"react-body-classname": "^1.3.1",
"react-dom": "^17.0.2",
"react-notion-x": "^6.7.0-alpha.2",
"react-static-tweets": "^0.7.1",
"react-static-tweets": "^0.7.2",
"react-use": "^17.3.2",
"static-tweets": "^0.7.1"
"static-tweets": "^0.7.2"
},
"devDependencies": {
"@next/bundle-analyzer": "^12.1.0",

View File

@@ -10,7 +10,7 @@ import {
} from 'notion-utils'
import { PageBlock } from 'notion-types'
import { notion } from 'lib/notion'
import { notion } from 'lib/notion-api'
import { getSiteForDomain } from 'lib/get-site-for-domain'
import { mapImageUrl } from 'lib/map-image-url'
import * as config from 'lib/config'

View File

@@ -3590,10 +3590,10 @@ react-remove-scroll@^2.4.0:
resolved "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.1.tgz"
integrity sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ==
react-static-tweets@^0.7.1:
version "0.7.1"
resolved "https://registry.npmjs.org/react-static-tweets/-/react-static-tweets-0.7.1.tgz"
integrity sha512-PWimW6Wcz1KEVPLVu7selfjmC2bOSucJlNDS3L3CdoUsvtbFj+4crv/4c+lu1QcktRZRAQplkCeEBRsRjoXrjA==
react-static-tweets@^0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/react-static-tweets/-/react-static-tweets-0.7.2.tgz#295c15ff5d5c1dc0039505d06986a7c49722506f"
integrity sha512-aHXGnMs+NVf6vW51HEee0h84iAShE3lfmTBPnYrse9uVU3QcDe+Vf8EBgCs6tmrnxl4vrGC2+1T4IKiIad9L+w==
dependencies:
classnames "^2.2.6"
swr "^1.0.0-beta.5"
@@ -4069,10 +4069,10 @@ standard-as-callback@^2.1.0:
resolved "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz"
integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==
static-tweets@^0.7.1:
version "0.7.1"
resolved "https://registry.npmjs.org/static-tweets/-/static-tweets-0.7.1.tgz"
integrity sha512-Jk9pmTXZOd+tibLvQxuQKX4txhwJIoYofco+R7v6wEctwIFFWxvwP5WpQdPRLWCRb4/l8EuWPiXqTt5TxbYRAg==
static-tweets@^0.7.2:
version "0.7.2"
resolved "https://registry.yarnpkg.com/static-tweets/-/static-tweets-0.7.2.tgz#d0bb8262856be600775562c05fd10ea3aedbbe9f"
integrity sha512-AyZOOOyAZ8UInonVsaOImQ5zcUfrFOhhV/UpnaecJ2joG7clG7I9Y5Uj9fJeYFE+QZaWQfsJQdJCUFaabzfQjQ==
dependencies:
"@mapbox/rehype-prism" "^0.5.0"
"@vercel/fetch" "^6.1.0"