gatsby-source-notion-churnotion 1.0.18 → 1.0.20
Sign up to get free protection for your applications and to get access to all the features.
package/dist/api/getPages.js
CHANGED
@@ -39,7 +39,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
39
39
|
reporter.warn(`[WARNING] Category without a title detected: ${categoryJsonData.id}`);
|
40
40
|
}
|
41
41
|
const nodeId = createNodeId(`${categoryJsonData.id}-category`);
|
42
|
-
categoryUrl +=
|
42
|
+
categoryUrl += `/${slug}`;
|
43
43
|
const categoryNode = {
|
44
44
|
id: nodeId,
|
45
45
|
category_name: title,
|
@@ -53,7 +53,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
53
53
|
.update(JSON.stringify(categoryJsonData))
|
54
54
|
.digest(`hex`),
|
55
55
|
},
|
56
|
-
url: `${constants_1.COMMON_URI}/${categoryUrl}`,
|
56
|
+
url: `${constants_1.COMMON_URI}/${constants_1.CATEGORY_URI}${categoryUrl}`,
|
57
57
|
};
|
58
58
|
createNode(categoryNode);
|
59
59
|
if (parentCategoryId && categoryNode) {
|
@@ -125,7 +125,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
125
125
|
}
|
126
126
|
const bookId = page.properties?.book?.relation?.[0]?.id || null;
|
127
127
|
const markdownContent = await connector_1.n2m.pageToMarkdown(page.id);
|
128
|
-
await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
|
128
|
+
const thumbnailUrl = await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
|
129
129
|
const postNode = {
|
130
130
|
id: nodeId,
|
131
131
|
category: parentCategoryId,
|
@@ -149,7 +149,8 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
149
149
|
},
|
150
150
|
tags: tagIds,
|
151
151
|
parent: null,
|
152
|
-
url: `${constants_1.COMMON_URI}${categoryUrl}/${slug}`,
|
152
|
+
url: `${constants_1.COMMON_URI}/${constants_1.POST_URI}${categoryUrl}/${slug}`,
|
153
|
+
thumbnailUrl: thumbnailUrl,
|
153
154
|
};
|
154
155
|
await createNode(postNode);
|
155
156
|
// book과 post 부모-자식 관계 설정
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { Actions, GatsbyCache, Reporter } from "gatsby";
|
2
2
|
import { MdBlock } from "notion-to-md/build/types";
|
3
|
-
export declare const processBlocks: (blocks: MdBlock[], actions: Actions, getCache: (this: void, id: string) => GatsbyCache, createNodeId: (this: void, input: string) => string, reporter: Reporter) => Promise<
|
3
|
+
export declare const processBlocks: (blocks: MdBlock[], actions: Actions, getCache: (this: void, id: string) => GatsbyCache, createNodeId: (this: void, input: string) => string, reporter: Reporter) => Promise<string>;
|
@@ -9,6 +9,7 @@ const path_1 = __importDefault(require("path"));
|
|
9
9
|
const crypto_1 = __importDefault(require("crypto"));
|
10
10
|
const processBlocks = async (blocks, actions, getCache, createNodeId, reporter) => {
|
11
11
|
const { createNode } = actions;
|
12
|
+
let thumbnailUrl = ``;
|
12
13
|
for (const block of blocks) {
|
13
14
|
// 이미지 블록 처리
|
14
15
|
if (block.type === `image` &&
|
@@ -34,6 +35,8 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
|
|
34
35
|
if (fileNode) {
|
35
36
|
const relativePath = `/static/images/${hashedFileName}`; // 해싱된 파일명을 사용
|
36
37
|
block.parent = `![${hashedFileName}](${relativePath})`; // Markdown 형식으로 업데이트
|
38
|
+
if (thumbnailUrl.length === 0)
|
39
|
+
thumbnailUrl = relativePath;
|
37
40
|
reporter.info(`[SUCCESS] Updated block with new hashed image path: ${block.parent}`);
|
38
41
|
}
|
39
42
|
}
|
@@ -43,5 +46,6 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
|
|
43
46
|
}
|
44
47
|
}
|
45
48
|
}
|
49
|
+
return thumbnailUrl;
|
46
50
|
};
|
47
51
|
exports.processBlocks = processBlocks;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-source-notion-churnotion",
|
3
3
|
"description": "Gatsby plugin that can connect with One Notion Database RECURSIVELY using official API",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.20",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|