From c2421f7a84ac7386844b91fd6da9645991b82e0b Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Wed, 6 Dec 2023 15:19:57 +0000 Subject: [PATCH] add the property 'status' for NotionNext --- README-zh.md | 11 +++++++++++ README.md | 16 +++++++++++++++- src/upload/upload_next/Upload2NotionNext.ts | 1 + src/upload/upload_next/getMarkdownNext.ts | 3 ++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README-zh.md b/README-zh.md index efb5382..1b68944 100644 --- a/README-zh.md +++ b/README-zh.md @@ -5,6 +5,17 @@ 所以我在[原作者](https://github.com/EasyChris/obsidian-to-notion)的基础之上,增加了匹配[NotionNext](https://github.com/tangly1024/NotionNext)模板的功能。这样可以直接在Obsidian编辑,整理好之后一键发布。 ## 更新说明 +### 1.1.2 +- 修复了一个拼写错误,导致无法同步`status`到NotionNext。现在你可以使用`stats`或者`status`来同步文章的状态到NotionNext。这个更新不会影响到同步到General数据库的功能。 +- **`stats`和`status`都可以使用,但是你只能使用其中一个。** + +```yaml +stats: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft +# or +status: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft +# both of them will work, but you can only use one of them. +``` + ### 1.1.1 - 修复了在日语系统下,无法显示设置按钮的错误。 - 增加日语翻译。 diff --git a/README.md b/README.md index 71e3aba..6c4877f 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,20 @@ Thus, based on the [original author's work](https://github.com/EasyChris/obsidia **Now, support both NotionNext and General databases.** ## Update +### 1.1.2 +- Fix the typo that you cannot sync the markdown file `status` in the frontmatter to NotionNext. You can use `stats` or `status` to sync the status of the post to NotionNext. This update will not affect the function of syncing to General database. +- 修复了一个拼写错误,导致无法同步`status`到NotionNext。现在你可以使用`stats`或者`status`来同步文章的状态到NotionNext。这个更新不会影响到同步到General数据库的功能。 +- **Both `stats` and `status` will work, but you can only use one of them.** +- **`stats`和`status`都可以使用,但是你只能使用其中一个。** + +For example, +```yaml +stats: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft +# or +status: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft +# both of them will work, but you can only use one of them. +``` + ### 1.1.1 - Fix the setting display bug in Japanese. - Add Japanese translation. @@ -167,7 +181,7 @@ date: 2023-07-23 # default is today, 默认是今天。 Format is YYYY-MM-DD coverurl: https://img.jxpeng.dev/2023/08/843e27a210847f05a0f7cfb121fec100.jpg # default is empty, 默认是空 type: Post # Post or Page, default is Post, 默认是Post slug: test # slug for url, default is empty, 默认是空 -stats: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft +stats: Draft # Draft, Invisible, Published, default is Draft, 默认是Draft category: test # default is 'Obsidian', 默认是'Obsidian' summary: this is a summary for test post # default is empty, 默认是空 icon: fa-solid fa-camera # you can ignore this, default is empty, 默认是空,可直接删除 diff --git a/src/upload/upload_next/Upload2NotionNext.ts b/src/upload/upload_next/Upload2NotionNext.ts index e1069ca..324cc38 100644 --- a/src/upload/upload_next/Upload2NotionNext.ts +++ b/src/upload/upload_next/Upload2NotionNext.ts @@ -251,6 +251,7 @@ export class Upload2NotionNext extends UploadBaseNext { file2Block ); } + if (res.status === 200) { await updateYamlInfo(markdown, nowFile, res, app, this.plugin) } else { diff --git a/src/upload/upload_next/getMarkdownNext.ts b/src/upload/upload_next/getMarkdownNext.ts index 0bfde8e..f5f8875 100644 --- a/src/upload/upload_next/getMarkdownNext.ts +++ b/src/upload/upload_next/getMarkdownNext.ts @@ -13,6 +13,7 @@ export async function getNowFileMarkdownContentNext( let type = ''; let slug = ''; let stats = ''; + let status = ''; let category = ''; let summary = ''; let paword = ''; @@ -26,7 +27,7 @@ export async function getNowFileMarkdownContentNext( tags = FileCache.frontmatter.tags; type = FileCache.frontmatter.type; slug = FileCache.frontmatter.slug; - stats = FileCache.frontmatter.stats; + stats = FileCache.frontmatter.stats || FileCache.frontmatter.status; category = FileCache.frontmatter.category; summary = FileCache.frontmatter.summary; paword = FileCache.frontmatter.password;