gatsby-source-notion-contents
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -5,2 +5,10 @@ "use strict"; | ||
const formatUid = uid => { | ||
if (uid.indexOf('-') === -1) { | ||
return `${uid.slice(0, 8)}-${uid.slice(8, 12)}-${uid.slice(12, 16)}-${uid.slice(16, 20)}-${uid.slice(20)}`; | ||
} | ||
return uid; | ||
}; | ||
const getSources = async ({ | ||
@@ -16,3 +24,7 @@ actions: { | ||
const notion = new Notion(options.token); | ||
const notion = new Notion(options.token, { | ||
prefix: options.prefix, | ||
removeStyle: options.removeStyle | ||
}); | ||
const hydratedIds = (options.ids || []).map(formatUid); | ||
const pageIds = (await notion.getPageIds()).concat(options.ids || []); | ||
@@ -19,0 +31,0 @@ const pages = await Promise.all(pageIds.map(async id => { |
{ | ||
"name": "gatsby-source-notion-contents", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Get gatsby sources from notion", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"@babel/runtime": "^7.7.7", | ||
"get-notion-contents": "^2.1.2" | ||
"get-notion-contents": "^2.1.3" | ||
}, | ||
@@ -32,0 +32,0 @@ "devDependencies": { |
@@ -16,2 +16,18 @@ # gatsby-source-notion-contents | ||
## Options | ||
```ts | ||
type Option = { | ||
token: string; // Required | ||
ids?: string[]; // Optional. To get contents that are out of scope. | ||
prefix?: string; // Optional. to add prefix into relative links | ||
removeStyle?: boolean; // Optional. to remove inline styles | ||
}; | ||
``` | ||
__ids__ | ||
If the URL is `https://www.notion.so/Personal-Home-db45cd2e7c694c3493c97f2376ab184a`, | ||
You need to add `db45cd2e7c694c3493c97f2376ab184a` into `options.ids`. | ||
## How to use | ||
@@ -29,2 +45,4 @@ ```js | ||
ids: ['<<ID_OF_NOTION_PAGE>>'], | ||
prefix: '/', | ||
removeStyle: false, | ||
}, | ||
@@ -36,6 +54,2 @@ }, | ||
If the URL is `https://www.notion.so/Personal-Home-db45cd2e7c694c3493c97f2376ab184a`, | ||
You need to add `db45cd2e7c694c3493c97f2376ab184a` into `options.ids`. | ||
(⚠️ `ids` is optional. but it **should** be array.) | ||
## How to query | ||
@@ -42,0 +56,0 @@ - Get all posts |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5168
58
133
Updatedget-notion-contents@^2.1.3